Module Name:    src
Committed By:   rillig
Date:           Fri Sep 25 20:48:23 UTC 2020

Modified Files:
        src/usr.bin/make: cond.c parse.c

Log Message:
make(1): rename variables cp2 to be more expressive


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/usr.bin/make/cond.c
cvs rdiff -u -r1.324 -r1.325 src/usr.bin/make/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.150 src/usr.bin/make/cond.c:1.151
--- src/usr.bin/make/cond.c:1.150	Fri Sep 25 15:54:50 2020
+++ src/usr.bin/make/cond.c	Fri Sep 25 20:48:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.150 2020/09/25 15:54:50 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.151 2020/09/25 20:48:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.150 2020/09/25 15:54:50 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.151 2020/09/25 20:48:23 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -245,13 +245,13 @@ ParseFuncArg(const char **pp, Boolean do
 	     * variable, so we don't need to do it. Nor do we return an error,
 	     * though perhaps we should...
 	     */
-	    void *freeIt;
+	    void *nestedVal_freeIt;
 	    VarEvalFlags eflags = VARE_UNDEFERR | (doEval ? VARE_WANTRES : 0);
-	    const char *cp2;
-	    (void)Var_Parse(&p, VAR_CMD, eflags, &cp2, &freeIt);
+	    const char *nestedVal;
+	    (void)Var_Parse(&p, VAR_CMD, eflags, &nestedVal, &nestedVal_freeIt);
 	    /* TODO: handle errors */
-	    Buf_AddStr(&argBuf, cp2);
-	    free(freeIt);
+	    Buf_AddStr(&argBuf, nestedVal);
+	    free(nestedVal_freeIt);
 	    continue;
 	}
 	if (ch == '(')

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.324 src/usr.bin/make/parse.c:1.325
--- src/usr.bin/make/parse.c:1.324	Thu Sep 24 07:11:29 2020
+++ src/usr.bin/make/parse.c	Fri Sep 25 20:48:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.324 2020/09/24 07:11:29 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.325 2020/09/25 20:48:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.324 2020/09/24 07:11:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.325 2020/09/25 20:48:23 rillig Exp $");
 
 /* types and constants */
 
@@ -1923,11 +1923,11 @@ Parse_DoVar(char *line, GNode *ctxt)
     if (DEBUG(LINT)) {
 	if (type != VAR_SUBST && strchr(cp, '$') != NULL) {
 	    /* sanity check now */
-	    char *cp2;
+	    char *expandedValue;
 
-	    (void)Var_Subst(cp, ctxt, VARE_ASSIGN, &cp2);
+	    (void)Var_Subst(cp, ctxt, VARE_ASSIGN, &expandedValue);
 	    /* TODO: handle errors */
-	    free(cp2);
+	    free(expandedValue);
 	}
     }
 
@@ -2925,21 +2925,23 @@ Parse_File(const char *name, int fd)
 		 * On the other hand they can be suffix rules (.c.o: ...)
 		 * or just dependencies for filenames that start '.'.
 		 */
-		for (cp = line + 1; ch_isspace(*cp); cp++) {
+		for (cp = line + 1; ch_isspace(*cp); cp++)
 		    continue;
-		}
 		if (IsInclude(cp, FALSE)) {
 		    ParseDoInclude(cp);
 		    continue;
 		}
 		if (strncmp(cp, "undef", 5) == 0) {
-		    char *cp2;
+		    const char *varname;
 		    for (cp += 5; ch_isspace(*cp); cp++)
 			continue;
-		    for (cp2 = cp; !ch_isspace(*cp2) && *cp2 != '\0'; cp2++)
+		    varname = cp;
+		    for (; !ch_isspace(*cp) && *cp != '\0'; cp++)
 			continue;
-		    *cp2 = '\0';
-		    Var_Delete(cp, VAR_GLOBAL);
+		    *cp = '\0';
+		    Var_Delete(varname, VAR_GLOBAL);
+		    /* TODO: undefine all variables, not only the first */
+		    /* TODO: use Str_Words, like everywhere else */
 		    continue;
 		} else if (strncmp(cp, "export", 6) == 0) {
 		    for (cp += 6; ch_isspace(*cp); cp++)

Reply via email to