Module Name: src
Committed By: rillig
Date: Thu Jun 24 23:19:52 UTC 2021
Modified Files:
src/usr.bin/make: for.c
Log Message:
make: sprinkle const
To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/usr.bin/make/for.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/for.c
diff -u src/usr.bin/make/for.c:1.142 src/usr.bin/make/for.c:1.143
--- src/usr.bin/make/for.c:1.142 Sat Apr 3 11:08:40 2021
+++ src/usr.bin/make/for.c Thu Jun 24 23:19:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: for.c,v 1.142 2021/04/03 11:08:40 rillig Exp $ */
+/* $NetBSD: for.c,v 1.143 2021/06/24 23:19:52 rillig Exp $ */
/*
* Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
#include "make.h"
/* "@(#)for.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: for.c,v 1.142 2021/04/03 11:08:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.143 2021/06/24 23:19:52 rillig Exp $");
/* One of the variables to the left of the "in" in a .for loop. */
@@ -72,15 +72,15 @@ typedef struct ForLoop {
Vector /* of ForVar */ vars; /* Iteration variables */
Words items; /* Substitution items */
Buffer curBody; /* Expanded body of the current iteration */
- /* Is any of the names 1 character long? If so, when the variable values
- * are substituted, the parser must handle $V expressions as well, not
- * only ${V} and $(V). */
+ /* Is any of the names 1 character long? If so, when the variable
+ * values are substituted, the parser must handle $V expressions as
+ * well, not only ${V} and $(V). */
bool short_var;
unsigned int sub_next; /* Where to continue iterating */
} ForLoop;
-static ForLoop *accumFor; /* Loop being accumulated */
+static ForLoop *accumFor; /* Loop being accumulated */
static int forLevel = 0; /* Nesting level */
@@ -376,8 +376,8 @@ ForLoop_SubstVarLong(ForLoop *f, const c
const char *p = *pp;
for (i = 0; i < f->vars.len; i++) {
- ForVar *forVar = Vector_Get(&f->vars, i);
- char *varname = forVar->name;
+ const ForVar *forVar = Vector_Get(&f->vars, i);
+ const char *varname = forVar->name;
size_t varnameLen = forVar->nameLen;
if (varnameLen >= (size_t)(bodyEnd - p))
@@ -413,7 +413,7 @@ static void
ForLoop_SubstVarShort(ForLoop *f, const char *p, const char **inout_mark)
{
const char ch = *p;
- ForVar *vars;
+ const ForVar *vars;
size_t i;
/* Skip $$ and stupid ones. */