From 8f30b68871bde8687c7fcff8bac66e2b5765129e Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Wed, 16 Sep 2009 17:07:01 +0000 Subject: - Add xcalloc() and call it - Fix memory errors found by valgrind - Remove multi_glob() and empower parse_file_seq() to do its job: the goal here is to remove the confusing reverse/re-reverse we do on the file lists: needed for future fixes. - Add a prefix arg to parse_file_seq() - Make concat() variadic so it can take arbitrary #'s of strings --- variable.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'variable.c') diff --git a/variable.c b/variable.c index 10bbc54..90c447c 100644 --- a/variable.c +++ b/variable.c @@ -979,7 +979,7 @@ target_environment (struct file *file) strcmp(v->name, "PATH") == 0) convert_Path_to_windows32(value, ';'); #endif - *result++ = xstrdup (concat (v->name, "=", value)); + *result++ = xstrdup (concat (3, v->name, "=", value)); free (value); } else @@ -989,7 +989,7 @@ target_environment (struct file *file) strcmp(v->name, "PATH") == 0) convert_Path_to_windows32(v->value, ';'); #endif - *result++ = xstrdup (concat (v->name, "=", v->value)); + *result++ = xstrdup (concat (3, v->name, "=", v->value)); } } @@ -1324,7 +1324,10 @@ parse_variable_definition (const char *p, enum variable_flavor *flavor) { wspace = 1; p = next_token (p); - c = *p++; + c = *p; + if (c == '\0') + return NULL; + ++p; } @@ -1333,8 +1336,9 @@ parse_variable_definition (const char *p, enum variable_flavor *flavor) *flavor = f_recursive; return (char *)p; } + /* Match assignment variants (:=, +=, ?=) */ - else if (*p == '=') + if (*p == '=') { switch (c) { @@ -1592,7 +1596,7 @@ sync_Path_environment (void) * Create something WINDOWS32 world can grok */ convert_Path_to_windows32 (path, ';'); - environ_path = xstrdup (concat ("PATH", "=", path)); + environ_path = xstrdup (concat (3, "PATH", "=", path)); putenv (environ_path); free (path); } -- cgit v1.2.3