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 CondGetString, replace repeated Buf...



details:   https://anonhg.NetBSD.org/src/rev/93f3de8db9d6
branches:  trunk
changeset: 954684:93f3de8db9d6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Sep 08 14:51:43 2020 +0000

description:
make(1): in CondGetString, replace repeated Buf_Add with Buf_AddStr

diffstat:

 usr.bin/make/cond.c |  15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diffs (49 lines):

diff -r 5a796d1873ea -r 93f3de8db9d6 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Tue Sep 08 14:17:03 2020 +0000
+++ b/usr.bin/make/cond.c       Tue Sep 08 14:51:43 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.112 2020/09/04 21:08:44 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.113 2020/09/08 14:51:43 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.112 2020/09/04 21:08:44 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.113 2020/09/08 14:51:43 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.112 2020/09/04 21:08:44 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.113 2020/09/08 14:51:43 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -386,7 +386,6 @@
 CondGetString(Boolean doEval, Boolean *quoted, void **freeIt, Boolean strictLHS)
 {
     Buffer buf;
-    const char *cp;
     const char *str;
     int len;
     Boolean qt;
@@ -455,12 +454,8 @@
                 strchr("!=><)", *condExpr))) {
                goto cleanup;
            }
-           /*
-            * Nope, we better copy str to buf
-            */
-           for (cp = str; *cp; cp++) {
-               Buf_AddByte(&buf, *cp);
-           }
+
+           Buf_AddStr(&buf, str);
            if (*freeIt) {
                free(*freeIt);
                *freeIt = NULL;



Home | Main Index | Thread Index | Old Index