summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-02-04 08:31:42 +0000
committerharti <harti@FreeBSD.org>2005-02-04 08:31:42 +0000
commit297b2c0b1b4881e4cfd4d93bd110ac8bbd646e28 (patch)
treedbfd6109e5efbd6003915e326219f2ff8c08bdbc /usr.bin/make
parentf95865e632d87418bc911826f039a716915a5086 (diff)
downloadFreeBSD-src-297b2c0b1b4881e4cfd4d93bd110ac8bbd646e28.zip
FreeBSD-src-297b2c0b1b4881e4cfd4d93bd110ac8bbd646e28.tar.gz
Use an extra variable to assign to instead of missusing an input
parameter. This will help in constification. Submitted by: Max Okumoto <okumoto@ucsd.edu>
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/var.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index 6b4d270..d212340 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -513,7 +513,7 @@ Var_Append(char *name, const char *val, GNode *ctxt)
Boolean
Var_Exists(char *name, GNode *ctxt)
{
- Var *v;
+ Var *v;
VarPossiblyExpand(&name, ctxt);
v = VarFind(name, ctxt, FIND_CMD|FIND_GLOBAL|FIND_ENV);
@@ -544,7 +544,7 @@ Var_Exists(char *name, GNode *ctxt)
char *
Var_Value(char *name, GNode *ctxt, char **frp)
{
- Var *v;
+ Var *v;
VarPossiblyExpand(&name, ctxt);
v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
@@ -1726,6 +1726,7 @@ Var_Subst(char *var, char *str, GNode *ctxt, Boolean undefErr)
char *val; /* Value to substitute for a variable */
size_t length; /* Length of the variable invocation */
Boolean doFree; /* Set true if val should be freed */
+ char *result;
static Boolean errorReported; /* Set true if an error has already
* been reported to prevent a plethora
* of messages when recursing */
@@ -1748,7 +1749,7 @@ Var_Subst(char *var, char *str, GNode *ctxt, Boolean undefErr)
* Skip as many characters as possible -- either to the end of
* the string or to the next dollar sign (variable invocation).
*/
- char *cp;
+ const char *cp;
for (cp = str++; *str != '$' && *str != '\0'; str++)
continue;
@@ -1765,8 +1766,7 @@ Var_Subst(char *var, char *str, GNode *ctxt, Boolean undefErr)
} else
expand = TRUE;
break;
- }
- else {
+ } else {
char *p;
/*
@@ -1861,9 +1861,9 @@ Var_Subst(char *var, char *str, GNode *ctxt, Boolean undefErr)
}
Buf_AddByte(buf, '\0');
- str = (char *)Buf_GetAll(buf, (size_t *)NULL);
+ result = (char *)Buf_GetAll(buf, (size_t *)NULL);
Buf_Destroy(buf, FALSE);
- return (str);
+ return (result);
}
/*-
OpenPOWER on IntegriCloud