make(1): migrate Lst_Find to Lst_FindS
This commit is contained in:
parent
acebd2797e
commit
4acfd85d5e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: arch.c,v 1.99 2020/08/27 19:15:35 rillig Exp $ */
|
||||
/* $NetBSD: arch.c,v 1.100 2020/08/28 04:28:45 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -69,14 +69,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: arch.c,v 1.99 2020/08/27 19:15:35 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: arch.c,v 1.100 2020/08/28 04:28:45 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: arch.c,v 1.99 2020/08/27 19:15:35 rillig Exp $");
|
||||
__RCSID("$NetBSD: arch.c,v 1.100 2020/08/28 04:28:45 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -548,7 +548,7 @@ ArchStatMember(const char *archive, const char *member, Boolean hash)
|
|||
member = base + 1;
|
||||
}
|
||||
|
||||
ln = Lst_Find(archives, ArchFindArchive, archive);
|
||||
ln = Lst_FindS(archives, ArchFindArchive, archive);
|
||||
if (ln != NULL) {
|
||||
ar = Lst_DatumS(ln);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cond.c,v 1.101 2020/08/27 19:15:35 rillig Exp $ */
|
||||
/* $NetBSD: cond.c,v 1.102 2020/08/28 04:28:45 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -70,14 +70,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: cond.c,v 1.101 2020/08/27 19:15:35 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: cond.c,v 1.102 2020/08/28 04:28:45 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: cond.c,v 1.101 2020/08/27 19:15:35 rillig Exp $");
|
||||
__RCSID("$NetBSD: cond.c,v 1.102 2020/08/28 04:28:45 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -284,7 +284,7 @@ CondFindStrMatch(const void *string, const void *pattern)
|
|||
static Boolean
|
||||
CondDoMake(int argLen MAKE_ATTR_UNUSED, const char *arg)
|
||||
{
|
||||
return Lst_Find(create, CondFindStrMatch, arg) != NULL;
|
||||
return Lst_FindS(create, CondFindStrMatch, arg) != NULL;
|
||||
}
|
||||
|
||||
/* See if the given file exists. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dir.c,v 1.117 2020/08/28 04:16:57 rillig Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.118 2020/08/28 04:28:45 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -70,14 +70,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: dir.c,v 1.117 2020/08/28 04:16:57 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: dir.c,v 1.118 2020/08/28 04:28:45 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: dir.c,v 1.117 2020/08/28 04:16:57 rillig Exp $");
|
||||
__RCSID("$NetBSD: dir.c,v 1.118 2020/08/28 04:28:45 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -1544,6 +1544,8 @@ Dir_MTime(GNode *gn, Boolean recheck)
|
|||
* Input:
|
||||
* path the path to which the directory should be
|
||||
* added
|
||||
* XXX: Why would this ever be NULL, and what does
|
||||
* that mean?
|
||||
* name the name of the directory to add
|
||||
*
|
||||
* Results:
|
||||
|
@ -1563,7 +1565,7 @@ Dir_AddDir(Lst path, const char *name)
|
|||
struct dirent *dp; /* entry in directory */
|
||||
|
||||
if (strcmp(name, ".DOTLAST") == 0) {
|
||||
ln = Lst_Find(path, DirFindName, name);
|
||||
ln = path != NULL ? Lst_FindS(path, DirFindName, name) : NULL;
|
||||
if (ln != NULL)
|
||||
return Lst_DatumS(ln);
|
||||
else {
|
||||
|
@ -1576,7 +1578,7 @@ Dir_AddDir(Lst path, const char *name)
|
|||
}
|
||||
|
||||
if (path)
|
||||
ln = Lst_Find(openDirectories, DirFindName, name);
|
||||
ln = Lst_FindS(openDirectories, DirFindName, name);
|
||||
if (ln != NULL) {
|
||||
p = Lst_DatumS(ln);
|
||||
if (path && Lst_MemberS(path, p) == NULL) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lst.c,v 1.48 2020/08/28 04:14:31 rillig Exp $ */
|
||||
/* $NetBSD: lst.c,v 1.49 2020/08/28 04:28:45 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -37,11 +37,11 @@
|
|||
#include "make.h"
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lst.c,v 1.48 2020/08/28 04:14:31 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: lst.c,v 1.49 2020/08/28 04:28:45 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: lst.c,v 1.48 2020/08/28 04:14:31 rillig Exp $");
|
||||
__RCSID("$NetBSD: lst.c,v 1.49 2020/08/28 04:28:45 rillig Exp $");
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
||||
|
@ -330,18 +330,6 @@ LstNode_SetNullS(LstNode node)
|
|||
* Node-specific functions
|
||||
*/
|
||||
|
||||
/* Return the first node from the given list, or NULL if the list is empty or
|
||||
* invalid. */
|
||||
static LstNode
|
||||
Lst_First(Lst list)
|
||||
{
|
||||
if (!LstIsValid(list) || LstIsEmpty(list)) {
|
||||
return NULL;
|
||||
} else {
|
||||
return list->first;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the first node from the given list, or NULL if the list is empty. */
|
||||
LstNode
|
||||
Lst_FirstS(Lst list)
|
||||
|
@ -399,14 +387,6 @@ Lst_IsEmptyS(Lst list)
|
|||
return LstIsEmpty(list);
|
||||
}
|
||||
|
||||
/* Return the first node from the given list for which the given comparison
|
||||
* function returns 0, or NULL if none of the nodes matches. */
|
||||
LstNode
|
||||
Lst_Find(Lst list, LstFindProc cmp, const void *cmpData)
|
||||
{
|
||||
return Lst_FindFrom(list, Lst_First(list), cmp, cmpData);
|
||||
}
|
||||
|
||||
/* Return the first node from the given list for which the given comparison
|
||||
* function returns 0, or NULL if none of the nodes matches. */
|
||||
LstNode
|
||||
|
@ -417,19 +397,6 @@ Lst_FindS(Lst list, LstFindProc cmp, const void *cmpData)
|
|||
return Lst_FindFromS(list, Lst_FirstS(list), cmp, cmpData);
|
||||
}
|
||||
|
||||
/* Return the first node from the given list, starting at the given node, for
|
||||
* which the given comparison function returns 0, or NULL if none of the nodes
|
||||
* matches. */
|
||||
LstNode
|
||||
Lst_FindFrom(Lst list, LstNode node, LstFindProc cmp, const void *cmpData)
|
||||
{
|
||||
if (!LstIsValid(list) || LstIsEmpty(list) || !LstNodeIsValid(node)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return Lst_FindFromS(list, node, cmp, cmpData);
|
||||
}
|
||||
|
||||
/* Return the first node from the given list, starting at the given node, for
|
||||
* which the given comparison function returns 0, or NULL if none of the nodes
|
||||
* matches. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lst.h,v 1.51 2020/08/28 04:16:57 rillig Exp $ */
|
||||
/* $NetBSD: lst.h,v 1.52 2020/08/28 04:28:45 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -145,10 +145,8 @@ void *Lst_DatumS(LstNode);
|
|||
* Functions for entire lists
|
||||
*/
|
||||
/* Find an element in a list */
|
||||
LstNode Lst_Find(Lst, LstFindProc, const void *);
|
||||
LstNode Lst_FindS(Lst, LstFindProc, const void *);
|
||||
/* Find an element starting from somewhere */
|
||||
LstNode Lst_FindFrom(Lst, LstNode, LstFindProc, const void *);
|
||||
LstNode Lst_FindFromS(Lst, LstNode, LstFindProc, const void *);
|
||||
/*
|
||||
* See if the given datum is on the list. Returns the LstNode containing
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.318 2020/08/28 04:14:31 rillig Exp $ */
|
||||
/* $NetBSD: main.c,v 1.319 2020/08/28 04:28:45 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -69,7 +69,7 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.318 2020/08/28 04:14:31 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.319 2020/08/28 04:28:45 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
|
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.318 2020/08/28 04:14:31 rillig Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.319 2020/08/28 04:28:45 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -1330,7 +1330,7 @@ main(int argc, char **argv)
|
|||
if (Lst_IsEmptyS(sysMkPath))
|
||||
Fatal("%s: no system rules (%s).", progname,
|
||||
_PATH_DEFSYSMK);
|
||||
ln = Lst_Find(sysMkPath, ReadMakefile, NULL);
|
||||
ln = Lst_FindS(sysMkPath, ReadMakefile, NULL);
|
||||
if (ln == NULL)
|
||||
Fatal("%s: cannot open %s.", progname,
|
||||
(char *)Lst_DatumS(ln));
|
||||
|
@ -1339,7 +1339,7 @@ main(int argc, char **argv)
|
|||
if (!Lst_IsEmptyS(makefiles)) {
|
||||
LstNode ln;
|
||||
|
||||
ln = Lst_Find(makefiles, ReadAllMakefiles, NULL);
|
||||
ln = Lst_FindS(makefiles, ReadAllMakefiles, NULL);
|
||||
if (ln != NULL)
|
||||
Fatal("%s: cannot open %s.", progname,
|
||||
(char *)Lst_DatumS(ln));
|
||||
|
@ -1348,7 +1348,7 @@ main(int argc, char **argv)
|
|||
VAR_CMD, VARE_WANTRES);
|
||||
if (p1) {
|
||||
(void)str2Lst_Append(makefiles, p1, NULL);
|
||||
(void)Lst_Find(makefiles, ReadMakefile, NULL);
|
||||
(void)Lst_FindS(makefiles, ReadMakefile, NULL);
|
||||
free(p1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: meta.c,v 1.104 2020/08/28 04:14:31 rillig Exp $ */
|
||||
/* $NetBSD: meta.c,v 1.105 2020/08/28 04:28:45 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Implement 'meta' mode.
|
||||
|
@ -1334,13 +1334,13 @@ meta_oodate(GNode *gn, Boolean oodate)
|
|||
case 'D': /* unlink */
|
||||
if (*p == '/' && !Lst_IsEmptyS(missingFiles)) {
|
||||
/* remove any missingFiles entries that match p */
|
||||
ln = Lst_Find(missingFiles, path_match, p);
|
||||
ln = Lst_FindS(missingFiles, path_match, p);
|
||||
if (ln != NULL) {
|
||||
LstNode nln;
|
||||
char *tp;
|
||||
|
||||
do {
|
||||
nln = Lst_FindFrom(missingFiles, Lst_SuccS(ln),
|
||||
nln = Lst_FindFromS(missingFiles, Lst_SuccS(ln),
|
||||
path_match, p);
|
||||
tp = Lst_DatumS(ln);
|
||||
Lst_RemoveS(missingFiles, ln);
|
||||
|
@ -1411,7 +1411,7 @@ meta_oodate(GNode *gn, Boolean oodate)
|
|||
if ((link_src != NULL && cached_lstat(p, &fs) < 0) ||
|
||||
(link_src == NULL && cached_stat(p, &fs) < 0)) {
|
||||
if (!meta_ignore(gn, p)) {
|
||||
if (Lst_Find(missingFiles, string_match, p) == NULL)
|
||||
if (Lst_FindS(missingFiles, string_match, p) == NULL)
|
||||
Lst_AppendS(missingFiles, bmake_strdup(p));
|
||||
}
|
||||
}
|
||||
|
@ -1497,7 +1497,7 @@ meta_oodate(GNode *gn, Boolean oodate)
|
|||
* A referenced file outside of CWD is missing.
|
||||
* We cannot catch every eventuality here...
|
||||
*/
|
||||
if (Lst_Find(missingFiles, string_match, p) == NULL)
|
||||
if (Lst_FindS(missingFiles, string_match, p) == NULL)
|
||||
Lst_AppendS(missingFiles, bmake_strdup(p));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: suff.c,v 1.123 2020/08/28 04:14:31 rillig Exp $ */
|
||||
/* $NetBSD: suff.c,v 1.124 2020/08/28 04:28:45 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -69,14 +69,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.123 2020/08/28 04:14:31 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.124 2020/08/28 04:28:45 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: suff.c,v 1.123 2020/08/28 04:14:31 rillig Exp $");
|
||||
__RCSID("$NetBSD: suff.c,v 1.124 2020/08/28 04:28:45 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -624,7 +624,7 @@ SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr)
|
|||
if (srcLn == NULL) {
|
||||
srcLn = Lst_FindS(sufflist, SuffSuffIsPrefix, str);
|
||||
} else {
|
||||
srcLn = Lst_FindFrom(sufflist, Lst_SuccS(srcLn),
|
||||
srcLn = Lst_FindFromS(sufflist, Lst_SuccS(srcLn),
|
||||
SuffSuffIsPrefix, str);
|
||||
}
|
||||
if (srcLn == NULL) {
|
||||
|
@ -713,7 +713,7 @@ Suff_AddTransform(char *line)
|
|||
*t; /* target suffix */
|
||||
LstNode ln; /* Node for existing transformation */
|
||||
|
||||
ln = Lst_Find(transforms, SuffGNHasNameP, line);
|
||||
ln = Lst_FindS(transforms, SuffGNHasNameP, line);
|
||||
if (ln == NULL) {
|
||||
/*
|
||||
* Make a new graph node for the transformation. It will be filled in
|
||||
|
@ -1818,7 +1818,7 @@ SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
|
|||
* Locate the transformation rule itself
|
||||
*/
|
||||
tname = str_concat2(s->name, t->name);
|
||||
ln = Lst_Find(transforms, SuffGNHasNameP, tname);
|
||||
ln = Lst_FindS(transforms, SuffGNHasNameP, tname);
|
||||
free(tname);
|
||||
|
||||
if (ln == NULL) {
|
||||
|
@ -1983,7 +1983,7 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
|
|||
*/
|
||||
sd.len = eoarch - gn->name;
|
||||
sd.ename = eoarch;
|
||||
ln = Lst_Find(ms->parents, SuffSuffIsSuffixP, &sd);
|
||||
ln = Lst_FindS(ms->parents, SuffSuffIsSuffixP, &sd);
|
||||
|
||||
if (ln != NULL) {
|
||||
/*
|
||||
|
@ -2093,7 +2093,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
|
|||
/*
|
||||
* Look for next possible suffix...
|
||||
*/
|
||||
ln = Lst_FindFrom(sufflist, ln, SuffSuffIsSuffixP, &sd);
|
||||
ln = Lst_FindFromS(sufflist, ln, SuffSuffIsSuffixP, &sd);
|
||||
|
||||
if (ln != NULL) {
|
||||
int prefLen; /* Length of the prefix */
|
||||
|
|
Loading…
Reference in New Issue