Module Name:    src
Committed By:   rillig
Date:           Mon Oct 19 21:41:31 UTC 2020

Modified Files:
        src/usr.bin/make: lst.c lst.h

Log Message:
make(1): remove unused Lst_ForEach

All of its uses have been inlined since iterating through a linked list
is trivial.  This avoids the cumbersome callback functions with void
pointer parameters, allowing the compiler to perform better type checks.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/make/lst.c
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/make/lst.h

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/lst.c
diff -u src/usr.bin/make/lst.c:1.77 src/usr.bin/make/lst.c:1.78
--- src/usr.bin/make/lst.c:1.77	Sun Oct 18 13:02:10 2020
+++ src/usr.bin/make/lst.c	Mon Oct 19 21:41:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.77 2020/10/18 13:02:10 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.78 2020/10/19 21:41:31 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -34,7 +34,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.77 2020/10/18 13:02:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.78 2020/10/19 21:41:31 rillig Exp $");
 
 /* Allocate and initialize a list node.
  *
@@ -308,14 +308,6 @@ Lst_FindDatum(List *list, const void *da
     return NULL;
 }
 
-void
-Lst_ForEach(List *list, LstActionProc proc, void *procData)
-{
-    ListNode *node;
-    for (node = list->first; node != NULL; node = node->next)
-	proc(node->datum, procData);
-}
-
 /* Apply the given function to each element of the given list. The function
  * should return 0 if traversal should continue and non-zero if it should
  * abort. */

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.72 src/usr.bin/make/lst.h:1.73
--- src/usr.bin/make/lst.h:1.72	Sun Oct 18 17:19:54 2020
+++ src/usr.bin/make/lst.h	Mon Oct 19 21:41:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.72 2020/10/18 17:19:54 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.73 2020/10/19 21:41:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -185,10 +185,6 @@ void LstNode_SetNull(ListNode *);
 
 /* Iterating over a list, using a callback function */
 
-/* Apply a function to each datum of the list.
- * The function must not modify the structure of the list, for example by
- * adding or removing nodes. */
-void Lst_ForEach(List *, LstActionProc, void *);
 /* Apply a function to each datum of the list, until the callback function
  * returns non-zero. */
 int Lst_ForEachUntil(List *, LstActionUntilProc, void *);

Reply via email to