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): make string iterator in ParseDependenc...



details:   https://anonhg.NetBSD.org/src/rev/7eb73ffc9407
branches:  trunk
changeset: 946185:7eb73ffc9407
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Nov 20 20:01:16 2020 +0000

description:
make(1): make string iterator in ParseDependencyTargetWord const

diffstat:

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

diffs (49 lines):

diff -r 8d8ba69aeff7 -r 7eb73ffc9407 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Fri Nov 20 18:49:44 2020 +0000
+++ b/usr.bin/make/parse.c      Fri Nov 20 20:01:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.444 2020/11/20 00:24:56 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.445 2020/11/20 20:01:16 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.444 2020/11/20 00:24:56 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.445 2020/11/20 20:01:16 rillig Exp $");
 
 /* types and constants */
 
@@ -1042,9 +1042,9 @@
 }
 
 static void
-ParseDependencyTargetWord(/*const*/ char **pp, const char *lstart)
+ParseDependencyTargetWord(const char **pp, const char *lstart)
 {
-    /*const*/ char *cp = *pp;
+    const char *cp = *pp;
 
     while (*cp != '\0') {
        if ((ch_isspace(*cp) || *cp == '!' || *cp == ':' || *cp == '(') &&
@@ -1422,6 +1422,7 @@
     char *cp = *inout_cp;
     char *tgt = *inout_line;
     char savec;
+    const char *p;
 
     for (;;) {
        /*
@@ -1431,7 +1432,9 @@
 
        /* Find the end of the next word. */
        cp = tgt;
-       ParseDependencyTargetWord(&cp, lstart);
+       p = cp;
+       ParseDependencyTargetWord(&p, lstart);
+       cp += p - cp;
 
        /*
         * If the word is followed by a left parenthesis, it's the



Home | Main Index | Thread Index | Old Index