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 variable in ParseDepende...



details:   https://anonhg.NetBSD.org/src/rev/e4fd2066e507
branches:  trunk
changeset: 1029260:e4fd2066e507
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Dec 28 17:58:41 2021 +0000

description:
make: remove redundant variable in ParseDependencyTargets

The idea of that variable was to work on constant strings as far as
possible.  For now it just blew up the code unnecessarily.

No binary change.

diffstat:

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

diffs (52 lines):

diff -r ff018e1fb6d1 -r e4fd2066e507 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Tue Dec 28 17:51:23 2021 +0000
+++ b/usr.bin/make/parse.c      Tue Dec 28 17:58:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.598 2021/12/28 17:45:56 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.599 2021/12/28 17:58:41 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.598 2021/12/28 17:45:56 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.599 2021/12/28 17:58:41 rillig Exp $");
 
 /* types and constants */
 
@@ -1010,7 +1010,7 @@
 }
 
 static void
-ParseDependencyTargetWord(const char **pp, const char *lstart)
+ParseDependencyTargetWord(char **pp, const char *lstart)
 {
        const char *cp = *pp;
 
@@ -1042,7 +1042,7 @@
                        cp++;
        }
 
-       *pp = cp;
+       *pp += cp - *pp;
 }
 
 /*
@@ -1386,14 +1386,11 @@
        char *cp;
        char *tgt = *inout_cp;
        char savec;
-       const char *p;
 
        for (;;) {
                /* Find the end of the next word. */
                cp = tgt;
-               p = cp;
-               ParseDependencyTargetWord(&p, lstart);
-               cp += p - cp;
+               ParseDependencyTargetWord(&cp, lstart);
 
                /*
                 * If the word is followed by a left parenthesis, it's the



Home | Main Index | Thread Index | Old Index