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 void pointers from ParseClearPath



details:   https://anonhg.NetBSD.org/src/rev/b441d88d7e8b
branches:  trunk
changeset: 956052:b441d88d7e8b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Oct 19 20:51:18 2020 +0000

description:
make(1): remove void pointers from ParseClearPath

diffstat:

 usr.bin/make/parse.c |  27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diffs (69 lines):

diff -r c774a065f09d -r b441d88d7e8b usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Mon Oct 19 20:41:53 2020 +0000
+++ b/usr.bin/make/parse.c      Mon Oct 19 20:51:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.391 2020/10/18 20:46:42 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.392 2020/10/19 20:51:18 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.391 2020/10/18 20:46:42 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.392 2020/10/19 20:51:18 rillig Exp $");
 
 /* types and constants */
 
@@ -196,6 +196,7 @@
 } ParseSpecial;
 
 typedef List SearchPathList;
+typedef ListNode SearchPathListNode;
 
 /* result data */
 
@@ -1018,12 +1019,6 @@
     (void)Dir_AddDir(path, name);
 }
 
-static void
-ParseClearPath(void *path, void *unused MAKE_ATTR_UNUSED)
-{
-    Dir_ClearPath(path);
-}
-
 /*
  * We got to the end of the line while we were still looking at targets.
  *
@@ -1350,6 +1345,18 @@
 }
 
 static void
+ClearPaths(SearchPathList *paths)
+{
+    if (paths != NULL) {
+       SearchPathListNode *ln;
+       for (ln = paths->first; ln != NULL; ln = ln->next)
+           Dir_ClearPath(ln->datum);
+    }
+
+    Dir_SetPATH();
+}
+
+static void
 ParseDoDependencySourcesEmpty(ParseSpecial const specType,
                              SearchPathList *const paths)
 {
@@ -1367,9 +1374,7 @@
        beSilent = TRUE;
        break;
     case ExPath:
-       if (paths != NULL)
-           Lst_ForEach(paths, ParseClearPath, NULL);
-       Dir_SetPATH();
+       ClearPaths(paths);
        break;
 #ifdef POSIX
     case Posix:



Home | Main Index | Thread Index | Old Index