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): migrate ApplyModifiers to Var_ParsePP



details:   https://anonhg.NetBSD.org/src/rev/4d6e3712ab30
branches:  trunk
changeset: 938393:4d6e3712ab30
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Sep 07 07:04:30 2020 +0000

description:
make(1): migrate ApplyModifiers to Var_ParsePP

diffstat:

 usr.bin/make/var.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (59 lines):

diff -r 3c96efe12ac2 -r 4d6e3712ab30 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Mon Sep 07 06:58:02 2020 +0000
+++ b/usr.bin/make/var.c        Mon Sep 07 07:04:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.488 2020/09/07 06:20:07 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.489 2020/09/07 07:04:30 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.488 2020/09/07 06:20:07 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.489 2020/09/07 07:04:30 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.488 2020/09/07 06:20:07 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.489 2020/09/07 07:04:30 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3016,9 +3016,10 @@
            /*
             * We may have some complex modifiers in a variable.
             */
-           int rlen;
+           const char *nested_p = p;
            void *freeIt;
-           const char *rval = Var_Parse(p, st.ctxt, st.eflags, &rlen, &freeIt);
+           const char *rval = Var_ParsePP(&nested_p, st.ctxt, st.eflags,
+                                          &freeIt);
 
            /*
             * If we have not parsed up to st.endc or ':',
@@ -3026,15 +3027,15 @@
             */
            int c;
            if (rval[0] != '\0' &&
-               (c = p[rlen]) != '\0' && c != ':' && c != st.endc) {
+               (c = *nested_p) != '\0' && c != ':' && c != st.endc) {
                free(freeIt);
                goto apply_mods;
            }
 
            VAR_DEBUG("Indirect modifier \"%s\" from \"%.*s\"\n",
-                     rval, rlen, p);
-
-           p += rlen;
+                     rval, (int)(size_t)(nested_p - p), p);
+
+           p = nested_p;
 
            if (rval[0] != '\0') {
                const char *rval_pp = rval;



Home | Main Index | Thread Index | Old Index