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: remove redundant parameter from ForLoop_S...



details:   https://anonhg.NetBSD.org/src/rev/03248513d1ae
branches:  trunk
changeset: 359538:03248513d1ae
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 09 00:33:57 2022 +0000

description:
make: remove redundant parameter from ForLoop_SubstVarLong

The buffer of a .for loop is always either empty or ends with '\n'.  A
variable name consists of arbitrary non-whitespace characters.
Therefore a variable name can never reach the end of the buffer.

No functional change.

diffstat:

 usr.bin/make/for.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r b1e53e687984 -r 03248513d1ae usr.bin/make/for.c
--- a/usr.bin/make/for.c        Sat Jan 08 23:57:32 2022 +0000
+++ b/usr.bin/make/for.c        Sun Jan 09 00:33:57 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.161 2022/01/08 23:52:26 rillig Exp $ */
+/*     $NetBSD: for.c,v 1.162 2022/01/09 00:33:57 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.161 2022/01/08 23:52:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.162 2022/01/09 00:33:57 rillig Exp $");
 
 
 typedef struct ForLoop {
@@ -363,7 +363,7 @@
  */
 static void
 ForLoop_SubstVarLong(ForLoop *f, Buffer *body, const char **pp,
-                    const char *end, char endc, const char **inout_mark)
+                    char endc, const char **inout_mark)
 {
        size_t i;
        const char *start = *pp;
@@ -373,7 +373,7 @@
                const char *p = start;
                const char *varname = vars[i];
 
-               while (p < end && *varname != '\0' && *p == *varname)
+               while (*varname != '\0' && *p == *varname)
                        p++, varname++;
                if (*varname != '\0')
                        continue;
@@ -456,7 +456,7 @@
                if (p[1] == '{' || p[1] == '(') {
                        char endc = p[1] == '{' ? '}' : ')';
                        p += 2;
-                       ForLoop_SubstVarLong(f, body, &p, end, endc, &mark);
+                       ForLoop_SubstVarLong(f, body, &p, endc, &mark);
                } else if (p[1] != '\0') {
                        ForLoop_SubstVarShort(f, body, p + 1, &mark);
                        p += 2;



Home | Main Index | Thread Index | Old Index