From 680612449a5db8f21059146529a2adf14e35185a Mon Sep 17 00:00:00 2001 From: Max Okumoto Date: Mon, 28 Feb 2005 12:00:10 +0000 Subject: [PATCH] Merge in some changes that Harti made to patch 7.49 --- usr.bin/make/for.c | 21 +++++++++------------ usr.bin/make/job.c | 16 ++++++++-------- usr.bin/make/suff.c | 12 +++++------- usr.bin/make/var.c | 4 +++- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c index c7785e79f8..f2b22ed557 100644 --- a/usr.bin/make/for.c +++ b/usr.bin/make/for.c @@ -31,7 +31,7 @@ * * @(#)for.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/make/for.c,v 1.35 2005/02/10 14:39:05 harti Exp $ - * $DragonFly: src/usr.bin/make/for.c,v 1.33 2005/02/26 01:52:24 okumoto Exp $ + * $DragonFly: src/usr.bin/make/for.c,v 1.34 2005/02/28 12:00:10 okumoto Exp $ */ /*- @@ -120,6 +120,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++) @@ -178,13 +179,10 @@ For_Eval(char *line) */ Lst_Init(&forLst); buf = Buf_Init(0); - { - Buffer *buf1; - buf1 = Var_Subst(NULL, ptr, VAR_CMD, FALSE); - sub = Buf_GetAll(buf1, NULL); - Buf_Destroy(buf1, 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++) ; @@ -273,7 +271,7 @@ For_Run(int lineno) Buffer *buf; /* the contents of the for loop */ const char *val; /* current value of loop variable */ LstNode *ln; - Buffer *buf2; + Buffer *buf1; char *str; if (forVar == NULL || forBuf == NULL) @@ -294,11 +292,10 @@ For_Run(int lineno) DEBUGF(FOR, ("--- %s = %s\n", var, val)); - buf2 = Var_Subst(var, - (char *)Buf_GetAll(buf, NULL), + buf1 = Var_Subst(var, (char *)Buf_GetAll(buf, NULL), VAR_GLOBAL, FALSE); - str = Buf_GetAll(buf2, NULL); - Buf_Destroy(buf2, FALSE); + str = Buf_GetAll(buf1, NULL); + Buf_Destroy(buf1, FALSE); Parse_FromString(str, lineno); Var_Delete(var, VAR_GLOBAL); diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 249a2b4bcc..5ddbf1bc2c 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -38,7 +38,7 @@ * * @(#)job.c 8.2 (Berkeley) 3/19/94 * $FreeBSD: src/usr.bin/make/job.c,v 1.75 2005/02/10 14:32:14 harti Exp $ - * $DragonFly: src/usr.bin/make/job.c,v 1.43 2005/02/15 01:01:18 okumoto Exp $ + * $DragonFly: src/usr.bin/make/job.c,v 1.44 2005/02/28 12:00:10 okumoto Exp $ */ #ifndef OLD_JOKE @@ -485,6 +485,7 @@ JobPrintCommand(void *cmdp, void *jobp) LstNode *cmdNode; /* Node for replacing the command */ char *cmd = cmdp; Job *job = jobp; + Buffer *buf; noSpecials = (noExecute && !(job->node->type & OP_MAKE)); @@ -509,13 +510,12 @@ JobPrintCommand(void *cmdp, void *jobp) * the variables in the command. */ cmdNode = Lst_Member(&job->node->commands, cmd); - { - Buffer *buf; - buf = Var_Subst(NULL, cmd, job->node, FALSE); - cmd = Buf_GetAll(buf, NULL); - Buf_Destroy(buf, FALSE); - cmdStart = cmd; - } + + buf = Var_Subst(NULL, cmd, job->node, FALSE); + cmd = Buf_GetAll(buf, NULL); + Buf_Destroy(buf, FALSE); + cmdStart = cmd; + Lst_Replace(cmdNode, cmdStart); cmdTemplate = "%s\n"; diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index 017d8cc1c2..934b989ef9 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -37,7 +37,7 @@ * * @(#)suff.c 8.4 (Berkeley) 3/21/94 * $FreeBSD: src/usr.bin/make/suff.c,v 1.43 2005/02/04 13:23:39 harti Exp $ - * $DragonFly: src/usr.bin/make/suff.c,v 1.34 2005/02/18 01:23:22 okumoto Exp $ + * $DragonFly: src/usr.bin/make/suff.c,v 1.35 2005/02/28 12:00:10 okumoto Exp $ */ /*- @@ -1296,6 +1296,7 @@ SuffExpandChildren(void *cgnp, void *pgnp) LstNode *prevLN; /* Node after which new source should be put */ LstNode *ln; /* List element for old source */ char *cp; /* Expanded value */ + Buffer *buf; /* * New nodes effectively take the place of the child, so place them @@ -1311,12 +1312,9 @@ SuffExpandChildren(void *cgnp, void *pgnp) */ if (strchr(cgn->name, '$') != NULL) { DEBUGF(SUFF, ("Expanding \"%s\"...", cgn->name)); - { - Buffer *buf; - buf = Var_Subst(NULL, cgn->name, pgn, TRUE); - cp = Buf_GetAll(buf, NULL); - Buf_Destroy(buf, FALSE); - } + buf = Var_Subst(NULL, cgn->name, pgn, TRUE); + cp = Buf_GetAll(buf, NULL); + Buf_Destroy(buf, FALSE); if (cp != NULL) { Lst members = Lst_Initializer(members); diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index f6a892456c..f52ba290b4 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -37,7 +37,7 @@ * * @(#)var.c 8.3 (Berkeley) 3/19/94 * $FreeBSD: src/usr.bin/make/var.c,v 1.83 2005/02/11 10:49:01 harti Exp $ - * $DragonFly: src/usr.bin/make/var.c,v 1.108 2005/02/26 01:52:24 okumoto Exp $ + * $DragonFly: src/usr.bin/make/var.c,v 1.109 2005/02/28 12:00:10 okumoto Exp $ */ /*- @@ -1853,6 +1853,7 @@ Var_Subst(const char *var, const char *str, GNode *ctxt, Boolean undefErr) /* * Set TRUE if an error has already been reported to prevent a * plethora of messages when recursing. + * XXXHB this comment sounds wrong. */ errorReported = FALSE; @@ -1871,6 +1872,7 @@ Var_Subst(const char *var, const 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 */ + /* * Variable invocation. */ -- 2.28.0