diff options
author | Paul Smith <psmith@gnu.org> | 2021-03-15 01:09:32 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2021-03-15 01:17:06 -0400 |
commit | 52056d7b2cb5c3c889096d2138b5b19124cdf6b0 (patch) | |
tree | 80f8a6042c858889c7d9ece11f765ea3862a47e9 /src/variable.h | |
parent | c66ec5fa20d33abf134892520179e32c2728e9b8 (diff) | |
download | make-git-52056d7b2cb5c3c889096d2138b5b19124cdf6b0.tar.gz |
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.
Diffstat (limited to 'src/variable.h')
-rw-r--r-- | src/variable.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/variable.h b/src/variable.h index 23f3282f..509777c4 100644 --- a/src/variable.h +++ b/src/variable.h @@ -129,6 +129,7 @@ char *allocated_variable_expand_for_file (const char *line, struct file *file); allocated_variable_expand_for_file (line, (struct file *) 0) char *expand_argument (const char *str, const char *end); char *variable_expand_string (char *line, const char *string, size_t length); +char *initialize_variable_output (); void install_variable_buffer (char **bufp, size_t *lenp); void restore_variable_buffer (char *buf, size_t len); |