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 ModifyWords simpler



details:   https://anonhg.NetBSD.org/src/rev/60f3415ebbd7
branches:  trunk
changeset: 1012531:60f3415ebbd7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 01 16:27:03 2020 +0000

description:
make(1): make ModifyWords simpler

There is no need to test whether an actual word has been added.  The
rule is simply "add a space before every word, except for the very
first".

diffstat:

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

diffs (38 lines):

diff -r 9775496b025d -r 60f3415ebbd7 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Aug 01 15:52:50 2020 +0000
+++ b/usr.bin/make/var.c        Sat Aug 01 16:27:03 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.381 2020/08/01 15:03:43 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.382 2020/08/01 16:27:03 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.381 2020/08/01 15:03:43 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.382 2020/08/01 16:27:03 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.381 2020/08/01 15:03:43 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.382 2020/08/01 16:27:03 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1597,10 +1597,8 @@
     }
 
     for (i = 0; i < ac; i++) {
-       size_t orig_count = result.buf.count;
        modifyWord(av[i], &result, data);
-       size_t count = result.buf.count;
-       if (count != orig_count)
+       if (result.buf.count > 0)
            SepBuf_Sep(&result);
     }
 



Home | Main Index | Thread Index | Old Index