Module Name:    src
Committed By:   rillig
Date:           Sun Nov 22 11:46:50 UTC 2020

Modified Files:
        src/usr.bin/make: suff.c

Log Message:
make(1): extract ExpandAllChildren from FindDepsArchive


To generate a diff of this commit:
cvs rdiff -u -r1.293 -r1.294 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.293 src/usr.bin/make/suff.c:1.294
--- src/usr.bin/make/suff.c:1.293	Sun Nov 22 11:30:02 2020
+++ src/usr.bin/make/suff.c	Sun Nov 22 11:46:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.293 2020/11/22 11:30:02 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.294 2020/11/22 11:46:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.293 2020/11/22 11:30:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.294 2020/11/22 11:46:49 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -1312,6 +1312,17 @@ ExpandChildren(GNodeListNode *cln, GNode
     Lst_Remove(cgn->parents, Lst_FindDatum(cgn->parents, pgn));
 }
 
+static void
+ExpandAllChildren(GNode *gn)
+{
+    GNodeListNode *ln, *nln;
+
+    for (ln = gn->children->first; ln != NULL; ln = nln) {
+	nln = ln->next;
+	ExpandChildren(ln, gn);
+    }
+}
+
 /* Find a path along which to expand the node.
  *
  * If the node has a known suffix, use that path.
@@ -1430,7 +1441,6 @@ FindDepsArchive(GNode *gn, CandidateList
     char *eoarch;		/* End of archive portion */
     char *eoname;		/* End of member portion */
     GNode *mem;			/* Node for member */
-    SuffixListNode *ln, *nln;	/* Next suffix node to check */
     Suffix *ms;			/* Suffix descriptor for member */
     char *name;			/* Start of member's name */
 
@@ -1498,10 +1508,7 @@ FindDepsArchive(GNode *gn, CandidateList
      * Now we've got the important local variables set, expand any sources
      * that still contain variables or wildcards in their names.
      */
-    for (ln = gn->children->first; ln != NULL; ln = nln) {
-	nln = ln->next;
-	ExpandChildren(ln, gn);
-    }
+    ExpandAllChildren(gn);
 
     if (ms != NULL) {
 	/*
@@ -1511,6 +1518,7 @@ FindDepsArchive(GNode *gn, CandidateList
 	 * member's suffix may be transformed...
 	 */
 	size_t nameLen = (size_t)(eoarch - gn->name);
+	SuffixListNode *ln;
 
 	/* Use first matching suffix... */
 	for (ln = ms->parents->first; ln != NULL; ln = ln->next)

Reply via email to