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): remove unused Lst_ForEach



details:   https://anonhg.NetBSD.org/src/rev/fc64f32e8e4f
branches:  trunk
changeset: 941154:fc64f32e8e4f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Oct 19 21:41:31 2020 +0000

description:
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.

diffstat:

 usr.bin/make/lst.c |  12 ++----------
 usr.bin/make/lst.h |   6 +-----
 2 files changed, 3 insertions(+), 15 deletions(-)

diffs (53 lines):

diff -r 1a0b304297dd -r fc64f32e8e4f usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Mon Oct 19 21:38:10 2020 +0000
+++ b/usr.bin/make/lst.c        Mon Oct 19 21:41:31 2020 +0000
@@ -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 @@
     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. */
diff -r 1a0b304297dd -r fc64f32e8e4f usr.bin/make/lst.h
--- a/usr.bin/make/lst.h        Mon Oct 19 21:38:10 2020 +0000
+++ b/usr.bin/make/lst.h        Mon Oct 19 21:41:31 2020 +0000
@@ -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 @@
 
 /* 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 *);



Home | Main Index | Thread Index | Old Index