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): in Var_Parse, replace bmake_strldup wi...



details:   https://anonhg.NetBSD.org/src/rev/03a7d2a34cf9
branches:  trunk
changeset: 943953:03a7d2a34cf9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Sep 13 21:03:14 2020 +0000

description:
make(1): in Var_Parse, replace bmake_strldup with bmake_strsedup

diffstat:

 usr.bin/make/var.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r 64b72cb8d340 -r 03a7d2a34cf9 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Sep 13 21:00:34 2020 +0000
+++ b/usr.bin/make/var.c        Sun Sep 13 21:03:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.518 2020/09/13 20:21:24 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.519 2020/09/13 21:03:14 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include    "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.518 2020/09/13 20:21:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.519 2020/09/13 21:03:14 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)   \
     if (!(DEBUG(VAR) && (cond)))       \
@@ -3646,8 +3646,10 @@
        }
     }
 
-    /* Skip past endc if possible. */
-    *pp = p + (*p ? 1 : 0);
+    if (*p != '\0')            /* Skip past endc if possible. */
+       p++;
+
+    *pp = p;
 
     if (v->flags & VAR_FROM_ENV) {
         /* Free the environment variable now since we own it,
@@ -3669,7 +3671,7 @@
                *freePtr = NULL;
            }
            if (dynamic) {
-               nstr = bmake_strldup(start, (size_t)(*pp - start));
+               nstr = bmake_strsedup(start, p);
                *freePtr = nstr;
            } else {
                nstr = (eflags & VARE_UNDEFERR) ? var_Error : varNoError;



Home | Main Index | Thread Index | Old Index