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): inline a local variable in VarUniq



details:   https://anonhg.NetBSD.org/src/rev/7ad03d2abb53
branches:  trunk
changeset: 938042:7ad03d2abb53
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Aug 31 19:09:19 2020 +0000

description:
make(1): inline a local variable in VarUniq

Just to eliminate any remote possibility of aliasing and thereby
forgetting to update all involved variables.

diffstat:

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

diffs (42 lines):

diff -r fe002ec728d0 -r 7ad03d2abb53 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Mon Aug 31 19:05:53 2020 +0000
+++ b/usr.bin/make/var.c        Mon Aug 31 19:09:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.481 2020/08/31 19:05:53 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.482 2020/08/31 19:09:19 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.481 2020/08/31 19:05:53 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.482 2020/08/31 19:09:19 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.481 2020/08/31 19:05:53 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.482 2020/08/31 19:09:19 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1609,13 +1609,12 @@
 VarUniq(const char *str)
 {
     Words words = Str_Words(str, FALSE);
-    char **av = words.words;
 
     if (words.len > 1) {
        size_t i, j;
        for (j = 0, i = 1; i < words.len; i++)
-           if (strcmp(av[i], av[j]) != 0 && (++j != i))
-               av[j] = av[i];
+           if (strcmp(words.words[i], words.words[j]) != 0 && (++j != i))
+               words.words[j] = words.words[i];
        words.len = j + 1;
     }
 



Home | Main Index | Thread Index | Old Index