Module Name:    src
Committed By:   rillig
Date:           Sun Aug 30 11:12:06 UTC 2020

Modified Files:
        src/usr.bin/make: compat.c dir.c job.c lst.c lst.h make.c suff.c

Log Message:
make(1): rename Lst_Memeber to Lst_FindDatum

The new name nicely aligns with Lst_Find and Lst_FindFrom.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.bin/make/compat.c
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/make/dir.c
cvs rdiff -u -r1.224 -r1.225 src/usr.bin/make/job.c
cvs rdiff -u -r1.56 -r1.57 src/usr.bin/make/lst.c
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/make/lst.h
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/make/make.c
cvs rdiff -u -r1.136 -r1.137 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/compat.c
diff -u src/usr.bin/make/compat.c:1.135 src/usr.bin/make/compat.c:1.136
--- src/usr.bin/make/compat.c:1.135	Sat Aug 29 14:47:26 2020
+++ src/usr.bin/make/compat.c	Sun Aug 30 11:12:05 2020
@@ -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);

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.124 src/usr.bin/make/dir.c:1.125
--- src/usr.bin/make/dir.c:1.124	Sat Aug 29 12:39:32 2020
+++ src/usr.bin/make/dir.c	Sun Aug 30 11:12:05 2020
@@ -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);
 	}

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.224 src/usr.bin/make/job.c:1.225
--- src/usr.bin/make/job.c:1.224	Sat Aug 29 12:20:17 2020
+++ src/usr.bin/make/job.c	Sun Aug 30 11:12:05 2020
@@ -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;
 	}

Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.56 src/usr.bin/make/lst.c:1.57
--- src/usr.bin/make/lst.c:1.56	Sat Aug 29 10:41:12 2020
+++ src/usr.bin/make/lst.c	Sun Aug 30 11:12:05 2020
@@ -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, Lst
 
 /* 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;
 

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.57 src/usr.bin/make/lst.h:1.58
--- src/usr.bin/make/lst.h:1.57	Sat Aug 29 10:41:12 2020
+++ src/usr.bin/make/lst.h	Sun Aug 30 11:12:06 2020
@@ -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. */

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.130 src/usr.bin/make/make.c:1.131
--- src/usr.bin/make/make.c:1.130	Sat Aug 29 13:16:54 2020
+++ src/usr.bin/make/make.c	Sun Aug 30 11:12:06 2020
@@ -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--;
     }

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.136 src/usr.bin/make/suff.c:1.137
--- src/usr.bin/make/suff.c:1.136	Sat Aug 29 13:38:48 2020
+++ src/usr.bin/make/suff.c	Sun Aug 30 11:12:06 2020
@@ -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 *p
      */
     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->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))

Reply via email to