make(1): rename Lst_Memeber to Lst_FindDatum

The new name nicely aligns with Lst_Find and Lst_FindFrom.
This commit is contained in:
rillig 2020-08-30 11:12:05 +00:00
parent c0fe0ae21d
commit 2d4a05ee59
7 changed files with 38 additions and 41 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat.c,v 1.135 2020/08/29 14:47:26 rillig Exp $ */
/* $NetBSD: compat.c,v 1.136 2020/08/30 11:12:05 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: compat.c,v 1.135 2020/08/29 14:47:26 rillig Exp $";
static char rcsid[] = "$NetBSD: compat.c,v 1.136 2020/08/30 11:12:05 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: compat.c,v 1.135 2020/08/29 14:47:26 rillig Exp $");
__RCSID("$NetBSD: compat.c,v 1.136 2020/08/30 11:12:05 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -220,7 +220,7 @@ CompatRunCommand(void *cmdp, void *gnp)
errCheck = !(gn->type & OP_IGNORE);
doIt = FALSE;
cmdNode = Lst_Member(gn->commands, cmd);
cmdNode = Lst_FindDatum(gn->commands, cmd);
cmdStart = Var_Subst(cmd, gn, VARE_WANTRES);
/*
@ -529,7 +529,7 @@ Compat_Make(void *gnp, void *pgnp)
goto cohorts;
}
if (Lst_Member(gn->iParents, pgn) != NULL) {
if (Lst_FindDatum(gn->iParents, pgn) != NULL) {
char *p1;
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn);
bmake_free(p1);
@ -633,7 +633,7 @@ Compat_Make(void *gnp, void *pgnp)
*/
pgn->flags &= ~(unsigned)REMAKE;
} else {
if (Lst_Member(gn->iParents, pgn) != NULL) {
if (Lst_FindDatum(gn->iParents, pgn) != NULL) {
char *p1;
const char *target = Var_Value(TARGET, gn, &p1);
Var_Set(IMPSRC, target != NULL ? target : "", pgn);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.124 2020/08/29 12:39:32 rillig Exp $ */
/* $NetBSD: dir.c,v 1.125 2020/08/30 11:12:05 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.124 2020/08/29 12:39:32 rillig Exp $";
static char rcsid[] = "$NetBSD: dir.c,v 1.125 2020/08/30 11:12:05 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.124 2020/08/29 12:39:32 rillig Exp $");
__RCSID("$NetBSD: dir.c,v 1.125 2020/08/30 11:12:05 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -406,7 +406,7 @@ Dir_InitDot(void)
LstNode ln;
/* Remove old entry from openDirectories, but do not destroy. */
ln = Lst_Member(openDirectories, dot);
ln = Lst_FindDatum(openDirectories, dot);
Lst_Remove(openDirectories, ln);
}
@ -1533,7 +1533,7 @@ Dir_AddDir(Lst path, const char *name)
ln = Lst_Find(openDirectories, DirFindName, name);
if (ln != NULL) {
p = Lst_Datum(ln);
if (Lst_Member(path, p) == NULL) {
if (Lst_FindDatum(path, p) == NULL) {
p->refCount += 1;
Lst_Append(path, p);
}
@ -1659,7 +1659,7 @@ Dir_Destroy(void *pp)
if (p->refCount == 0) {
LstNode ln;
ln = Lst_Member(openDirectories, p);
ln = Lst_FindDatum(openDirectories, p);
Lst_Remove(openDirectories, ln);
Hash_DeleteTable(&p->files);
@ -1721,7 +1721,7 @@ Dir_Concat(Lst path1, Lst path2)
for (ln = Lst_First(path2); ln != NULL; ln = LstNode_Next(ln)) {
p = Lst_Datum(ln);
if (Lst_Member(path1, p) == NULL) {
if (Lst_FindDatum(path1, p) == NULL) {
p->refCount += 1;
Lst_Append(path1, p);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.224 2020/08/29 12:20:17 rillig Exp $ */
/* $NetBSD: job.c,v 1.225 2020/08/30 11:12:05 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: job.c,v 1.224 2020/08/29 12:20:17 rillig Exp $";
static char rcsid[] = "$NetBSD: job.c,v 1.225 2020/08/30 11:12:05 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: job.c,v 1.224 2020/08/29 12:20:17 rillig Exp $");
__RCSID("$NetBSD: job.c,v 1.225 2020/08/30 11:12:05 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -708,7 +708,7 @@ JobPrintCommand(void *cmdp, void *jobp)
if (strcmp(cmd, "...") == 0) {
job->node->type |= OP_SAVE_CMDS;
if ((job->flags & JOB_IGNDOTS) == 0) {
LstNode dotsNode = Lst_Member(job->node->commands, cmd);
LstNode dotsNode = Lst_FindDatum(job->node->commands, cmd);
job->tailCmds = dotsNode != NULL ? LstNode_Next(dotsNode) : NULL;
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lst.c,v 1.56 2020/08/29 10:41:12 rillig Exp $ */
/* $NetBSD: lst.c,v 1.57 2020/08/30 11:12:05 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.56 2020/08/29 10:41:12 rillig Exp $";
static char rcsid[] = "$NetBSD: lst.c,v 1.57 2020/08/30 11:12:05 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: lst.c,v 1.56 2020/08/29 10:41:12 rillig Exp $");
__RCSID("$NetBSD: lst.c,v 1.57 2020/08/30 11:12:05 rillig Exp $");
#endif /* not lint */
#endif
@ -406,7 +406,7 @@ Lst_FindFrom(Lst list, LstNode node, LstFindProc match, const void *matchArgs)
/* Return the first node that contains the given datum, or NULL. */
LstNode
Lst_Member(Lst list, void *datum)
Lst_FindDatum(Lst list, const void *datum)
{
LstNode node;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lst.h,v 1.57 2020/08/29 10:41:12 rillig Exp $ */
/* $NetBSD: lst.h,v 1.58 2020/08/30 11:12:06 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -148,11 +148,8 @@ void *Lst_Datum(LstNode);
LstNode Lst_Find(Lst, LstFindProc, const void *);
/* Find an element starting from somewhere */
LstNode Lst_FindFrom(Lst, LstNode, LstFindProc, const void *);
/*
* See if the given datum is on the list. Returns the LstNode containing
* the datum
*/
LstNode Lst_Member(Lst, void *);
/* Return the first node that contains the given datum, or NULL. */
LstNode Lst_FindDatum(Lst, const void *);
/* Apply a function to all elements of a lst */
int Lst_ForEach(Lst, LstActionProc, void *);
/* Apply a function to all elements of a lst starting from a certain point. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.c,v 1.130 2020/08/29 13:16:54 rillig Exp $ */
/* $NetBSD: make.c,v 1.131 2020/08/30 11:12:06 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: make.c,v 1.130 2020/08/29 13:16:54 rillig Exp $";
static char rcsid[] = "$NetBSD: make.c,v 1.131 2020/08/30 11:12:06 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: make.c,v 1.130 2020/08/29 13:16:54 rillig Exp $");
__RCSID("$NetBSD: make.c,v 1.131 2020/08/30 11:12:06 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -561,7 +561,7 @@ MakeHandleUse(void *cgnp, void *pgnp)
* children the parent has. This is used by Make_Run to decide
* whether to queue the parent or examine its children...
*/
if ((ln = Lst_Member(pgn->children, cgn)) != NULL) {
if ((ln = Lst_FindDatum(pgn->children, cgn)) != NULL) {
Lst_Remove(pgn->children, ln);
pgn->unmade--;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: suff.c,v 1.136 2020/08/29 13:38:48 rillig Exp $ */
/* $NetBSD: suff.c,v 1.137 2020/08/30 11:12:06 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: suff.c,v 1.136 2020/08/29 13:38:48 rillig Exp $";
static char rcsid[] = "$NetBSD: suff.c,v 1.137 2020/08/30 11:12:06 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.136 2020/08/29 13:38:48 rillig Exp $");
__RCSID("$NetBSD: suff.c,v 1.137 2020/08/30 11:12:06 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -330,7 +330,7 @@ SuffUnRef(void *lp, void *sp)
{
Lst l = (Lst) lp;
LstNode ln = Lst_Member(l, sp);
LstNode ln = Lst_FindDatum(l, sp);
if (ln != NULL) {
Lst_Remove(l, ln);
((Suff *)sp)->refCount--;
@ -1052,7 +1052,7 @@ SuffRemoveSrc(Lst l)
free(s->pref);
else {
#ifdef DEBUG_SRC
LstNode ln2 = Lst_Member(s->parent->cp, s);
LstNode ln2 = Lst_FindDatum(s->parent->cp, s);
if (ln2 != NULL)
Lst_Remove(s->parent->cp, ln2);
#endif
@ -1209,7 +1209,7 @@ SuffFindCmds(Src *targ, Lst slst)
/* XXX: Can targ->suff be NULL here? */
if (targ->suff != NULL &&
Lst_Member(suff->parents, targ->suff) != NULL)
Lst_FindDatum(suff->parents, targ->suff) != NULL)
break;
}
@ -1395,7 +1395,7 @@ SuffExpandChildren(LstNode cln, GNode *pgn)
*/
pgn->unmade--;
Lst_Remove(pgn->children, cln);
Lst_Remove(cgn->parents, Lst_Member(cgn->parents, pgn));
Lst_Remove(cgn->parents, Lst_FindDatum(cgn->parents, pgn));
}
static void
@ -1444,7 +1444,7 @@ SuffExpandWildcards(LstNode cln, GNode *pgn)
*/
pgn->unmade--;
Lst_Remove(pgn->children, cln);
Lst_Remove(cgn->parents, Lst_Member(cgn->parents, pgn));
Lst_Remove(cgn->parents, Lst_FindDatum(cgn->parents, pgn));
}
/* Find a path along which to expand the node.
@ -1992,7 +1992,7 @@ sfnd_abort:
* up to, but not including, the parent node.
*/
while (bottom && bottom->parent != NULL) {
if (Lst_Member(slst, bottom) == NULL) {
if (Lst_FindDatum(slst, bottom) == NULL) {
Lst_Append(slst, bottom);
}
bottom = bottom->parent;
@ -2068,7 +2068,7 @@ sfnd_abort:
*/
sfnd_return:
if (bottom)
if (Lst_Member(slst, bottom) == NULL)
if (Lst_FindDatum(slst, bottom) == NULL)
Lst_Append(slst, bottom);
while (SuffRemoveSrc(srcs) || SuffRemoveSrc(targs))