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 local variable



details:   https://anonhg.NetBSD.org/src/rev/31e458bf8651
branches:  trunk
changeset: 1029230:31e458bf8651
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Dec 28 01:27:37 2021 +0000

description:
make: remove redundant local variable

The variable name 'end' suggested pointing to the end of the string, but
instead it pointed to the last possible starting position of the word to
be searched.  Remove this possible misunderstanding.

No functional change.

diffstat:

 usr.bin/make/parse.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 73570c1b7e37 -r 31e458bf8651 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Tue Dec 28 01:20:24 2021 +0000
+++ b/usr.bin/make/parse.c      Tue Dec 28 01:27:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.587 2021/12/27 21:21:17 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.588 2021/12/28 01:27:37 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.587 2021/12/27 21:21:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.588 2021/12/28 01:27:37 rillig Exp $");
 
 /* types and constants */
 
@@ -2307,16 +2307,15 @@
 {
        size_t strLen = strlen(str);
        size_t wordLen = strlen(word);
-       const char *p, *end;
+       const char *p;
 
        if (strLen < wordLen)
                return false;
 
-       end = str + strLen - wordLen;
        for (p = str; p != NULL; p = strchr(p, ' ')) {
                if (*p == ' ')
                        p++;
-               if (p > end)
+               if (p > str + strLen - wordLen)
                        return false;
 
                if (memcmp(p, word, wordLen) == 0 &&



Home | Main Index | Thread Index | Old Index