Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): rename ApplyModifiersState.cp to next
details: https://anonhg.NetBSD.org/src/rev/484528731fee
branches: trunk
changeset: 936499:484528731fee
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Jul 27 23:24:55 2020 +0000
description:
make(1): rename ApplyModifiersState.cp to next
The name "next" is more descriptive than a mere "cp". It's easy to look
up the type of the variable, but not so easy to guess the purpose of the
variable, therefore the new name concentrates on the purpose.
diffstat:
usr.bin/make/var.c | 237 ++++++++++++++++++++++++++--------------------------
1 files changed, 119 insertions(+), 118 deletions(-)
diffs (truncated from 708 to 300 lines):
diff -r 2dab6c64962c -r 484528731fee usr.bin/make/var.c
--- a/usr.bin/make/var.c Mon Jul 27 23:04:18 2020 +0000
+++ b/usr.bin/make/var.c Mon Jul 27 23:24:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.347 2020/07/27 23:04:18 rillig Exp $ */
+/* $NetBSD: var.c,v 1.348 2020/07/27 23:24:55 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.347 2020/07/27 23:04:18 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.348 2020/07/27 23:24:55 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: var.c,v 1.347 2020/07/27 23:04:18 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.348 2020/07/27 23:24:55 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -2046,7 +2046,7 @@
/* read-write */
char *nstr;
- const char *cp; /* The position where parsing continues
+ const char *next; /* The position where parsing continues
* after the current modifier. */
char termc; /* Character which terminated scan */
char missing_delim; /* For error reporting */
@@ -2085,23 +2085,23 @@
ModifyWord_LoopArgs args;
args.ctx = st->ctxt;
- st->cp = mod + 1;
+ st->next = mod + 1;
char delim = '@';
- args.tvar = ParseModifierPart(&st->cp, delim, st->eflags & ~VARE_WANTRES,
+ args.tvar = ParseModifierPart(&st->next, delim, st->eflags & ~VARE_WANTRES,
st->ctxt, NULL, NULL, NULL);
if (args.tvar == NULL) {
st->missing_delim = delim;
return FALSE;
}
- args.str = ParseModifierPart(&st->cp, delim, st->eflags & ~VARE_WANTRES,
+ args.str = ParseModifierPart(&st->next, delim, st->eflags & ~VARE_WANTRES,
st->ctxt, NULL, NULL, NULL);
if (args.str == NULL) {
st->missing_delim = delim;
return FALSE;
}
- st->termc = *st->cp;
+ st->termc = *st->next;
args.eflags = st->eflags & (VARE_UNDEFERR | VARE_WANTRES);
int prev_sep = st->sep;
@@ -2167,8 +2167,8 @@
}
}
- st->cp = p;
- st->termc = *st->cp;
+ st->next = p;
+ st->termc = *st->next;
if (st->v->flags & VAR_JUNK)
st->v->flags |= VAR_KEEP;
@@ -2185,7 +2185,7 @@
ApplyModifier_Gmtime(const char *mod, ApplyModifiersState *st)
{
if (!ModMatchEq(mod, "gmtime", st->endc)) {
- st->cp = mod + 1;
+ st->next = mod + 1;
return FALSE;
}
@@ -2193,13 +2193,13 @@
if (mod[6] == '=') {
char *ep;
utc = strtoul(mod + 7, &ep, 10);
- st->cp = ep;
+ st->next = ep;
} else {
utc = 0;
- st->cp = mod + 6;
+ st->next = mod + 6;
}
st->newStr = VarStrftime(st->nstr, 1, utc);
- st->termc = *st->cp;
+ st->termc = *st->next;
return TRUE;
}
@@ -2208,7 +2208,7 @@
ApplyModifier_Localtime(const char *mod, ApplyModifiersState *st)
{
if (!ModMatchEq(mod, "localtime", st->endc)) {
- st->cp = mod + 1;
+ st->next = mod + 1;
return FALSE;
}
@@ -2216,13 +2216,13 @@
if (mod[9] == '=') {
char *ep;
utc = strtoul(mod + 10, &ep, 10);
- st->cp = ep;
+ st->next = ep;
} else {
utc = 0;
- st->cp = mod + 9;
+ st->next = mod + 9;
}
st->newStr = VarStrftime(st->nstr, 0, utc);
- st->termc = *st->cp;
+ st->termc = *st->next;
return TRUE;
}
@@ -2231,13 +2231,13 @@
ApplyModifier_Hash(const char *mod, ApplyModifiersState *st)
{
if (!ModMatch(mod, "hash", st->endc)) {
- st->cp = mod + 1;
+ st->next = mod + 1;
return FALSE;
}
st->newStr = VarHash(st->nstr);
- st->cp = mod + 4;
- st->termc = *st->cp;
+ st->next = mod + 4;
+ st->termc = *st->next;
return TRUE;
}
@@ -2257,17 +2257,17 @@
}
if (!st->newStr)
st->newStr = bmake_strdup(st->v->name);
- st->cp = mod + 1;
- st->termc = *st->cp;
+ st->next = mod + 1;
+ st->termc = *st->next;
}
/* :!cmd! */
static Boolean
ApplyModifier_Exclam(const char *mod, ApplyModifiersState *st)
{
- st->cp = mod + 1;
+ st->next = mod + 1;
char delim = '!';
- char *cmd = ParseModifierPart(&st->cp, delim, st->eflags, st->ctxt,
+ char *cmd = ParseModifierPart(&st->next, delim, st->eflags, st->ctxt,
NULL, NULL, NULL);
if (cmd == NULL) {
st->missing_delim = delim;
@@ -2284,7 +2284,7 @@
if (emsg)
Error(emsg, st->nstr);
- st->termc = *st->cp;
+ st->termc = *st->next;
if (st->v->flags & VAR_JUNK)
st->v->flags |= VAR_KEEP;
return TRUE;
@@ -2295,7 +2295,7 @@
ApplyModifier_Range(const char *mod, ApplyModifiersState *st)
{
if (!ModMatchEq(mod, "range", st->endc)) {
- st->cp = mod + 1;
+ st->next = mod + 1;
return FALSE;
}
@@ -2303,13 +2303,13 @@
if (mod[5] == '=') {
char *ep;
n = strtoul(mod + 6, &ep, 10);
- st->cp = ep;
+ st->next = ep;
} else {
n = 0;
- st->cp = mod + 5;
+ st->next = mod + 5;
}
st->newStr = VarRange(st->nstr, n);
- st->termc = *st->cp;
+ st->termc = *st->next;
return TRUE;
}
@@ -2344,9 +2344,9 @@
break;
}
}
- st->cp = p;
- st->termc = *st->cp;
- const char *endpat = st->cp;
+ st->next = p;
+ st->termc = *st->next;
+ const char *endpat = st->next;
char *pattern;
if (copy) {
@@ -2397,19 +2397,19 @@
Boolean oneBigWord = st->oneBigWord;
char delim = mod[1];
- st->cp = mod + 2;
+ st->next = mod + 2;
/*
* If pattern begins with '^', it is anchored to the
* start of the word -- skip over it and flag pattern.
*/
args.pflags = 0;
- if (*st->cp == '^') {
+ if (*st->next == '^') {
args.pflags |= VARP_ANCHOR_START;
- st->cp++;
+ st->next++;
}
- char *lhs = ParseModifierPart(&st->cp, delim, st->eflags, st->ctxt,
+ char *lhs = ParseModifierPart(&st->next, delim, st->eflags, st->ctxt,
&args.lhsLen, &args.pflags, NULL);
if (lhs == NULL) {
st->missing_delim = delim;
@@ -2417,7 +2417,7 @@
}
args.lhs = lhs;
- char *rhs = ParseModifierPart(&st->cp, delim, st->eflags, st->ctxt,
+ char *rhs = ParseModifierPart(&st->next, delim, st->eflags, st->ctxt,
&args.rhsLen, NULL, &args);
if (rhs == NULL) {
st->missing_delim = delim;
@@ -2430,8 +2430,8 @@
* delimiter, substitution is global and is marked that
* way.
*/
- for (;; st->cp++) {
- switch (*st->cp) {
+ for (;; st->next++) {
+ switch (*st->next) {
case 'g':
args.pflags |= VARP_SUB_GLOBAL;
continue;
@@ -2445,7 +2445,7 @@
break;
}
- st->termc = *st->cp;
+ st->termc = *st->next;
st->newStr = ModifyWords(st->ctxt, st->sep, oneBigWord, st->nstr,
ModifyWord_Subst, &args);
@@ -2466,16 +2466,16 @@
Boolean oneBigWord = st->oneBigWord;
char delim = mod[1];
- st->cp = mod + 2;
-
- char *re = ParseModifierPart(&st->cp, delim, st->eflags, st->ctxt,
+ st->next = mod + 2;
+
+ char *re = ParseModifierPart(&st->next, delim, st->eflags, st->ctxt,
NULL, NULL, NULL);
if (re == NULL) {
st->missing_delim = delim;
return FALSE;
}
- args.replace = ParseModifierPart(&st->cp, delim, st->eflags, st->ctxt,
+ args.replace = ParseModifierPart(&st->next, delim, st->eflags, st->ctxt,
NULL, NULL, NULL);
if (args.replace == NULL) {
free(re);
@@ -2483,8 +2483,8 @@
return FALSE;
}
- for (;; st->cp++) {
- switch (*st->cp) {
+ for (;; st->next++) {
+ switch (*st->next) {
case 'g':
args.pflags |= VARP_SUB_GLOBAL;
continue;
@@ -2498,7 +2498,7 @@
break;
Home |
Main Index |
Thread Index |
Old Index