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: separate cases in HandleDependencyTargetM...



details:   https://anonhg.NetBSD.org/src/rev/a47c3932abbb
branches:  trunk
changeset: 366742:a47c3932abbb
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jun 11 17:41:35 2022 +0000

description:
make: separate cases in HandleDependencyTargetMundane

Most targets do not use wildcards, so there is no need to put the single
item into a list.

No functional change.

diffstat:

 usr.bin/make/parse.c |  23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diffs (50 lines):

diff -r 125cfa888aad -r a47c3932abbb usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Jun 11 16:47:24 2022 +0000
+++ b/usr.bin/make/parse.c      Sat Jun 11 17:41:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.677 2022/06/11 16:47:24 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.678 2022/06/11 17:41:35 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -105,7 +105,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.677 2022/06/11 16:47:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.678 2022/06/11 17:41:35 rillig Exp $");
 
 /*
  * A file being read.
@@ -1033,21 +1033,22 @@
 }
 
 static void
-HandleDependencyTargetMundane(char *targetName)
+HandleDependencyTargetMundane(const char *targetName)
 {
-       StringList targetNames = LST_INIT;
-
        if (Dir_HasWildcards(targetName)) {
+               StringList targetNames = LST_INIT;
+
                SearchPath *emptyPath = SearchPath_New();
                SearchPath_Expand(emptyPath, targetName, &targetNames);
                SearchPath_Free(emptyPath);
+
+               while (!Lst_IsEmpty(&targetNames)) {
+                       char *targName = Lst_Dequeue(&targetNames);
+                       HandleSingleDependencyTargetMundane(targName);
+                       /* TODO: free targName */
+               }
        } else
-               Lst_Append(&targetNames, targetName);
-
-       while (!Lst_IsEmpty(&targetNames)) {
-               char *targName = Lst_Dequeue(&targetNames);
-               HandleSingleDependencyTargetMundane(targName);
-       }
+               HandleSingleDependencyTargetMundane(targetName);
 }
 
 static void



Home | Main Index | Thread Index | Old Index