summaryrefslogtreecommitdiff
path: root/main.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 /main.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 'main.c')
-rw-r--r--main.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/main.c b/main.c
index 1c30884..dd309df 100644
--- a/main.c
+++ b/main.c
@@ -1312,7 +1312,7 @@ main (int argc, char **argv, char **envp)
&& (strchr (argv[0], '/') != 0 || strchr (argv[0], '\\') != 0)
# endif
)
- argv[0] = xstrdup (concat (current_directory, "/", argv[0]));
+ argv[0] = xstrdup (concat (3, current_directory, "/", argv[0]));
#else /* !__MSDOS__ */
if (current_directory[0] != '\0'
&& argv[0] != 0 && argv[0][0] != '/' && strchr (argv[0], '/') != 0
@@ -1321,7 +1321,7 @@ main (int argc, char **argv, char **envp)
&& strchr (argv[0], '\\') != 0
#endif
)
- argv[0] = xstrdup (concat (current_directory, "/", argv[0]));
+ argv[0] = xstrdup (concat (3, current_directory, "/", argv[0]));
#endif /* !__MSDOS__ */
#endif /* WINDOWS32 */
#endif
@@ -2008,7 +2008,7 @@ main (int argc, char **argv, char **envp)
/* This cast is OK since we never modify argv. */
argv[++i] = (char *) makefiles->list[j];
else
- argv[i] = xstrdup (concat ("-f", makefiles->list[j], ""));
+ argv[i] = xstrdup (concat (2, "-f", makefiles->list[j]));
++j;
}
}
@@ -2019,7 +2019,7 @@ main (int argc, char **argv, char **envp)
{
nargv = xmalloc ((nargc + 2) * sizeof (char *));
memcpy (nargv, argv, argc * sizeof (char *));
- nargv[nargc++] = xstrdup (concat ("-o", stdin_nm, ""));
+ nargv[nargc++] = xstrdup (concat (2, "-o", stdin_nm));
nargv[nargc] = 0;
}
else
@@ -2192,8 +2192,7 @@ main (int argc, char **argv, char **envp)
{
struct nameseq *ns;
- ns = multi_glob (parse_file_seq (&p, '\0', sizeof (struct nameseq), 1),
- sizeof (struct nameseq), 0);
+ ns = parse_file_seq (&p, sizeof (struct nameseq), '\0', NULL, 0);
if (ns)
{
/* .DEFAULT_GOAL should contain one target. */
@@ -2670,7 +2669,7 @@ decode_env_switches (char *envar, unsigned int len)
definition. Add a dash and pass it along to decode_switches. We
need permanent storage for this in case decode_switches saves
pointers into the value. */
- argv[1] = xstrdup (concat ("-", argv[1], ""));
+ argv[1] = xstrdup (concat (2, "-", argv[1]));
/* Parse those words. */
decode_switches (argc, argv, 1);