Module Name:    src
Committed By:   rillig
Date:           Sun Dec 17 09:02:26 UTC 2023

Modified Files:
        src/usr.bin/make: main.c make.h meta.c

Log Message:
make: clean up unused return value of str2Lst_Append

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.604 -r1.605 src/usr.bin/make/main.c
cvs rdiff -u -r1.326 -r1.327 src/usr.bin/make/make.h
cvs rdiff -u -r1.206 -r1.207 src/usr.bin/make/meta.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/main.c
diff -u src/usr.bin/make/main.c:1.604 src/usr.bin/make/main.c:1.605
--- src/usr.bin/make/main.c:1.604	Sun Dec 17 08:53:55 2023
+++ src/usr.bin/make/main.c	Sun Dec 17 09:02:26 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.604 2023/12/17 08:53:55 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.605 2023/12/17 09:02:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.604 2023/12/17 08:53:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.605 2023/12/17 09:02:26 rillig Exp $");
 #if defined(MAKE_NATIVE)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -772,22 +772,17 @@ SetVarObjdir(bool writable, const char *
 }
 
 /*
- * Splits str into words, adding them to the list.
+ * Splits str into words (in-place, modifying it), adding them to the list.
  * The string must be kept alive as long as the list.
  */
-int
-str2Lst_Append(StringList *lp, char *str)
+void
+AppendWords(StringList *lp, char *str)
 {
 	char *p;
-	int n;
-
 	const char *sep = " \t";
 
-	for (n = 0, p = strtok(str, sep); p != NULL; p = strtok(NULL, sep)) {
+	for (p = strtok(str, sep); p != NULL; p = strtok(NULL, sep))
 		Lst_Append(lp, p);
-		n++;
-	}
-	return n;
 }
 
 #ifdef SIGINFO
@@ -1293,7 +1288,7 @@ ReadFirstDefaultMakefile(void)
 	    SCOPE_CMDLINE, VARE_WANTRES);
 	/* TODO: handle errors */
 
-	(void)str2Lst_Append(&makefiles, prefs);
+	AppendWords(&makefiles, prefs);
 
 	for (ln = makefiles.first; ln != NULL; ln = ln->next)
 		if (ReadMakefile(ln->datum))

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.326 src/usr.bin/make/make.h:1.327
--- src/usr.bin/make/make.h:1.326	Thu Nov  2 04:50:44 2023
+++ src/usr.bin/make/make.h	Sun Dec 17 09:02:26 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.326 2023/11/02 04:50:44 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.327 2023/12/17 09:02:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -1040,7 +1040,7 @@ void PrintOnError(GNode *, const char *)
 void Main_ExportMAKEFLAGS(bool);
 bool Main_SetObjdir(bool, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
 int mkTempFile(const char *, char *, size_t) MAKE_ATTR_USE;
-int str2Lst_Append(StringList *, char *);
+void AppendWords(StringList *, char *);
 void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *);
 bool GNode_ShouldExecute(GNode *gn) MAKE_ATTR_USE;
 

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.206 src/usr.bin/make/meta.c:1.207
--- src/usr.bin/make/meta.c:1.206	Sat Aug 19 00:09:17 2023
+++ src/usr.bin/make/meta.c	Sun Dec 17 09:02:26 2023
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.206 2023/08/19 00:09:17 sjg Exp $ */
+/*      $NetBSD: meta.c,v 1.207 2023/12/17 09:02:26 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -613,7 +613,7 @@ meta_mode_init(const char *make_mode)
     metaBailiwickStr = Var_Subst("${.MAKE.META.BAILIWICK:O:u:tA}",
 				 SCOPE_GLOBAL, VARE_WANTRES);
     /* TODO: handle errors */
-    str2Lst_Append(&metaBailiwick, metaBailiwickStr);
+    AppendWords(&metaBailiwick, metaBailiwickStr);
     /*
      * We ignore any paths that start with ${.MAKE.META.IGNORE_PATHS}
      */
@@ -622,7 +622,7 @@ meta_mode_init(const char *make_mode)
     metaIgnorePathsStr = Var_Subst("${" MAKE_META_IGNORE_PATHS ":O:u:tA}",
 				   SCOPE_GLOBAL, VARE_WANTRES);
     /* TODO: handle errors */
-    str2Lst_Append(&metaIgnorePaths, metaIgnorePathsStr);
+    AppendWords(&metaIgnorePaths, metaIgnorePathsStr);
 
     /*
      * We ignore any paths that match ${.MAKE.META.IGNORE_PATTERNS}

Reply via email to