diff options
author | harti <harti@FreeBSD.org> | 2005-02-25 13:16:56 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2005-02-25 13:16:56 +0000 |
commit | d1abcd79ac0bffbc9147263601cfc48932ff7994 (patch) | |
tree | 963a624e0fb5923bd6f2945b59e5f91ad527872d /usr.bin/make/for.c | |
parent | 3155a16bbff21fc68e2028ac99868d17bffa9767 (diff) | |
download | FreeBSD-src-d1abcd79ac0bffbc9147263601cfc48932ff7994.zip FreeBSD-src-d1abcd79ac0bffbc9147263601cfc48932ff7994.tar.gz |
Change the return value of Var_Subst to return a Buffer instead
of a char *.
Patch: 7.49
Submitted by: Max Okumoto <okumoto@ucsd.edu>
Diffstat (limited to 'usr.bin/make/for.c')
-rw-r--r-- | usr.bin/make/for.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c index 068d887..653414c 100644 --- a/usr.bin/make/for.c +++ b/usr.bin/make/for.c @@ -121,6 +121,7 @@ For_Eval(char *line) * maybe start of a for loop */ Buffer *buf; + Buffer *buf1; size_t varlen; for (ptr++; *ptr && isspace((unsigned char)*ptr); ptr++) @@ -179,7 +180,10 @@ For_Eval(char *line) */ Lst_Init(&forLst); buf = Buf_Init(0); - sub = Var_Subst(NULL, ptr, VAR_CMD, FALSE); + + buf1 = Var_Subst(NULL, ptr, VAR_CMD, FALSE); + sub = Buf_GetAll(buf1, NULL); + Buf_Destroy(buf1, FALSE); for (ptr = sub; *ptr && isspace((unsigned char)*ptr); ptr++) ; @@ -268,6 +272,8 @@ For_Run(int lineno) Buffer *buf; /* the contents of the for loop */ const char *val; /* current value of loop variable */ LstNode *ln; + Buffer *buf1; + char *str; if (forVar == NULL || forBuf == NULL) return; @@ -286,10 +292,12 @@ For_Run(int lineno) Var_Set(var, val, VAR_GLOBAL); DEBUGF(FOR, ("--- %s = %s\n", var, val)); - Parse_FromString(Var_Subst(var, - (char *)Buf_GetAll(buf, NULL), - VAR_GLOBAL, FALSE), lineno); + buf1 = Var_Subst(var, (char *)Buf_GetAll(buf, NULL), + VAR_GLOBAL, FALSE); + str = Buf_GetAll(buf1, NULL); + Buf_Destroy(buf1, FALSE); + Parse_FromString(str, lineno); Var_Delete(var, VAR_GLOBAL); } |