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 DirFindName



details:   https://anonhg.NetBSD.org/src/rev/41eee0ad81a5
branches:  trunk
changeset: 956225:41eee0ad81a5
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 24 09:18:09 2020 +0000

description:
make(1): inline DirFindName

diffstat:

 usr.bin/make/dir.c |  24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

diffs (52 lines):

diff -r c60e93bc9251 -r 41eee0ad81a5 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Sat Oct 24 09:03:54 2020 +0000
+++ b/usr.bin/make/dir.c        Sat Oct 24 09:18:09 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.172 2020/10/22 05:50:02 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.173 2020/10/24 09:18:09 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -135,7 +135,7 @@
 #include "job.h"
 
 /*     "@(#)dir.c      8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: dir.c,v 1.172 2020/10/22 05:50:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.173 2020/10/24 09:18:09 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -527,16 +527,6 @@
     }
 }
 
-/* See if the CachedDir structure describes the same directory as the
- * given one by comparing their names. Called from Dir_AddDir via
- * Lst_Find when searching the list of open directories. */
-static Boolean
-DirFindName(const void *p, const void *desiredName)
-{
-    const CachedDir *dir = p;
-    return strcmp(dir->name, desiredName) == 0;
-}
-
 /* See if the given name has any wildcard characters in it. Be careful not to
  * expand unmatching brackets or braces.
  *
@@ -1508,9 +1498,13 @@
     struct dirent *dp;
 
     if (path != NULL && strcmp(name, ".DOTLAST") == 0) {
-       SearchPathNode *ln = Lst_Find(path, DirFindName, name);
-       if (ln != NULL)
-           return ln->datum;
+       SearchPathNode *ln;
+
+       for (ln = path->first; ln != NULL; ln = ln->next) {
+           CachedDir *pathDir = ln->datum;
+           if (strcmp(pathDir->name, name) == 0)
+               return pathDir;
+       }
 
        dotLast->refCount++;
        Lst_Prepend(path, dotLast);



Home | Main Index | Thread Index | Old Index