summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-02-11 17:03:18 +0000
committerharti <harti@FreeBSD.org>2005-02-11 17:03:18 +0000
commit878b2ba45f06740d2893669b3d640964325df72d (patch)
tree379acfa568f5be60f4f3a5aba5237bca01861d62 /usr.bin/make
parentccef1b4a6de8361bf5f885d80dc303bc2661b47b (diff)
downloadFreeBSD-src-878b2ba45f06740d2893669b3d640964325df72d.zip
FreeBSD-src-878b2ba45f06740d2893669b3d640964325df72d.tar.gz
Stylistic fixes: push variable into a local context (this part is going
to be split out into a function soon). Also there is no need to write back the colon that we have NUL-ed - the string is going to be freed anyway. Submitted by: Max Okumoto <okumoto@ucsd.edu>
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/main.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index f53e1f2..398cd43 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -805,28 +805,30 @@ main(int argc, char **argv)
* <directory>:<directory>:<directory>...
*/
if (Var_Exists("VPATH", VAR_CMD)) {
- char *vpath, savec;
/*
* GCC stores string constants in read-only memory, but
* Var_Subst will want to write this thing, so store it
* in an array
*/
static char VPATH[] = "${VPATH}";
+ char *vpath;
+ char savec;
+ char *ptr;
vpath = Var_Subst(NULL, VPATH, VAR_CMD, FALSE);
- path = vpath;
do {
/* skip to end of directory */
- for (cp = path; *cp != ':' && *cp != '\0'; cp++)
- continue;
+ for (ptr = vpath; *ptr != ':' && *ptr != '\0'; cp++)
+ ;
+
/* Save terminator character so know when to stop */
- savec = *cp;
- *cp = '\0';
+ savec = *ptr;
+ *ptr = '\0';
+
/* Add directory to search path */
- Dir_AddDir(&dirSearchPath, path);
- *cp = savec;
- path = cp + 1;
- } while (savec == ':');
+ Dir_AddDir(&dirSearchPath, vpath);
+ vpath = ptr + 1;
+ } while (savec != '\0');
free(vpath);
}
OpenPOWER on IntegriCloud