]> git.ipfire.org Git - thirdparty/make.git/commit
Ensure variable_buffer is always set.
authorPaul Smith <psmith@gnu.org>
Mon, 15 Mar 2021 05:09:32 +0000 (01:09 -0400)
committerPaul Smith <psmith@gnu.org>
Mon, 15 Mar 2021 05:17:06 +0000 (01:17 -0400)
commit52056d7b2cb5c3c889096d2138b5b19124cdf6b0
tree80f8a6042c858889c7d9ece11f765ea3862a47e9
parentc66ec5fa20d33abf134892520179e32c2728e9b8
Ensure variable_buffer is always set.

Initialize the global variable_buffer in main() so that it is never
a null pointer.  Then invoking variable_expand("") is never needed:
simply use the variable_buffer pointer when we want to restart the
variable buffer.  The main point of this simplification is not to
keep a separate pointer to the beginning of the buffer: this is
dangerous because the buffer may be re-allocated.  Instead always
use the variable_buffer pointer itself.

* src/variable.h (initialize_variable_output): Publish.
* src/expand.c (initialize_variable_output): Remove static.
* src/main.c (main): Initialize variable_buffer.
* src/file.c (enter_prereqs): Don't call variable_expand("") and
don't save a separate buffer pointer than might be outdated.
(expand_deps): Ditto.
* src/read.c (record_files): Ditto.
* src/remake.c (library_search): Ditto.
src/expand.c
src/file.c
src/main.c
src/read.c
src/remake.c
src/variable.h