summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2009-09-16 17:07:01 +0000
committerPaul Smith <psmith@gnu.org>2009-09-16 17:07:01 +0000
commit8f30b68871bde8687c7fcff8bac66e2b5765129e (patch)
tree78e7e64f0c47dff023bebe15ee57b85f8db6a826 /variable.c
parent5abe47762071f024409f7fd16c9cb76b31833379 (diff)
downloadgunmake-8f30b68871bde8687c7fcff8bac66e2b5765129e.tar.gz
- 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
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c14
1 files changed, 9 insertions, 5 deletions
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);
}