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): clean up SuffFindNormalDepsKnown



details:   https://anonhg.NetBSD.org/src/rev/a0866d56f2c7
branches:  trunk
changeset: 945107:a0866d56f2c7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Oct 21 06:34:26 2020 +0000

description:
make(1): clean up SuffFindNormalDepsKnown

diffstat:

 usr.bin/make/suff.c |  64 +++++++++++++++++++++-------------------------------
 1 files changed, 26 insertions(+), 38 deletions(-)

diffs (92 lines):

diff -r a86409c3e5bd -r a0866d56f2c7 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Wed Oct 21 06:30:30 2020 +0000
+++ b/usr.bin/make/suff.c       Wed Oct 21 06:34:26 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.202 2020/10/21 06:30:30 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.203 2020/10/21 06:34:26 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.202 2020/10/21 06:30:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.203 2020/10/21 06:34:26 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -1593,49 +1593,37 @@
                        const char *eoname, const char *sopref,
                        SrcList *srcs, SrcList *targs)
 {
-    SuffListNode *ln = sufflist->first;
+    SuffListNode *ln;
+    const char *eopref;
+    Src *targ;
 
-    while (ln != NULL) {
-       /*
-        * Look for next possible suffix...
-        */
-       ln = Lst_FindFrom(sufflist, ln, SuffSuffIsSuffix, sd);
-
-       if (ln != NULL) {
-           const char *eopref;
+    for (ln = sufflist->first; ln != NULL; ln = ln->next) {
+       if (!SuffSuffIsSuffix(ln->datum, sd))
+           continue;
 
-           /*
-            * Allocate a Src structure to which things can be transformed
-            */
-           Src *targ = bmake_malloc(sizeof(Src));
-           targ->file = bmake_strdup(gn->name);
-           targ->suff = ln->datum;
-           targ->suff->refCount++;
-           targ->node = gn;
-           targ->parent = NULL;
-           targ->children = 0;
+       targ = bmake_malloc(sizeof(Src));
+       targ->file = bmake_strdup(gn->name);
+       targ->suff = ln->datum;
+       targ->suff->refCount++;
+       targ->node = gn;
+       targ->parent = NULL;
+       targ->children = 0;
 #ifdef DEBUG_SRC
-           targ->cp = Lst_New();
+       targ->cp = Lst_New();
 #endif
 
-           eopref = eoname - targ->suff->nameLen;
-           targ->pref = bmake_strsedup(sopref, eopref);
-
-           /*
-            * Add nodes from which the target can be made
-            */
-           SuffAddLevel(srcs, targ);
+       eopref = eoname - targ->suff->nameLen;
+       targ->pref = bmake_strsedup(sopref, eopref);
 
-           /*
-            * Record the target so we can nuke it
-            */
-           Lst_Append(targs, targ);
+       /*
+        * Add nodes from which the target can be made
+        */
+       SuffAddLevel(srcs, targ);
 
-           /*
-            * Search from this suffix's successor...
-            */
-           ln = ln->next;
-       }
+       /*
+        * Record the target so we can nuke it
+        */
+       Lst_Append(targs, targ);
     }
 }
 



Home | Main Index | Thread Index | Old Index