mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-01 21:33:04 +00:00
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>
This commit is contained in:
parent
7fbdc92113
commit
157e401636
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=141697
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user