Module Name: src
Committed By: rillig
Date: Sat Aug 1 16:27:03 UTC 2020
Modified Files:
src/usr.bin/make: var.c
Log Message:
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".
To generate a diff of this commit:
cvs rdiff -u -r1.381 -r1.382 src/usr.bin/make/var.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.381 src/usr.bin/make/var.c:1.382
--- src/usr.bin/make/var.c:1.381 Sat Aug 1 15:03:43 2020
+++ src/usr.bin/make/var.c Sat Aug 1 16:27:03 2020
@@ -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 @@ ModifyWords(GNode *ctx, Byte sep, Boolea
}
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);
}