There are lots of places in muon where we want to manipulate strings.
In some cases it is appropriate to use the make_str() + str_app()
method. However, in other cases, it would be better to avoid
allocation.
The solution so far has been to write specialized buffer functions that
append a buffer and check that it doesn't overflow, etc., for every
different case. Sometimes these buffers can grow with realloc,
sometimes they are static only.
sbuf is a sort of compromise. It starts out with a stack allocated
static array that is somewhat small, and can be configured to overflow
into either an unmanaged allocation, or into the workspace string pool.
Some other nice features include a mode that transparently writes output
to a FILE * rather than a buffer, which means that there is no longer a
limit on the length obj_fprintf can output.
The plan is to change the signature of the path_ functions to use sbuf
rather than a buffer + length. That means we can finally get away from
PATH_MAX everywhere.
I tried to fix this by ending the argstr in a triple NUL, but that has
an edge case when the last element of argv is empty. This time fix it
more robustly by tracking argc separately.
This ensures that MESON_BUILD_ROOT and MESON_SOURCE_ROOT are always set
correctly. It also simplifies env to envp, and makes more type errors
catchable during configure.
* Added a object type 'obj_alias_type'
* Implemented the meson function alias_target()
* Added support for generating alias_targets
* Copied and modified the relevant test from meson
Currently because run targets are not implemented there are TODOs where
they should be handled.
This is because ninja uses $ as a special character. Ninja also uses $
as its escape character, so escaping it with \ just results in garbage
being added to the commandline.