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

This commit is contained in:
rillig 2020-09-25 20:48:23 +00:00
parent 922e04669b
commit ba0ed6616b
2 changed files with 20 additions and 18 deletions

View File

@ -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 doEval, const char *func,
* 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 == '(')

View File

@ -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++)