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 redundant parameter from str2Ls...



details:   https://anonhg.NetBSD.org/src/rev/6cfc23a0c67a
branches:  trunk
changeset: 957027:6cfc23a0c67a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 14 17:39:59 2020 +0000

description:
make(1): remove redundant parameter from str2Lst_Append

diffstat:

 usr.bin/make/main.c |  13 +++++++------
 usr.bin/make/make.h |   4 ++--
 usr.bin/make/meta.c |   6 +++---
 3 files changed, 12 insertions(+), 11 deletions(-)

diffs (91 lines):

diff -r 1a6d8c30c806 -r 6cfc23a0c67a usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Nov 14 17:39:14 2020 +0000
+++ b/usr.bin/make/main.c       Sat Nov 14 17:39:59 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.461 2020/11/14 17:39:14 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.462 2020/11/14 17:39:59 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.461 2020/11/14 17:39:14 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.462 2020/11/14 17:39:59 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -778,14 +778,15 @@
        return TRUE;
 }
 
+/* Splits str into words, adding them to the list.
+ * The string must be kept alive as long as the list. */
 int
-str2Lst_Append(StringList *lp, char *str, const char *sep)
+str2Lst_Append(StringList *lp, char *str)
 {
        char *cp;
        int n;
 
-       if (sep == NULL)
-               sep = " \t";
+       const char *sep = " \t";
 
        for (n = 0, cp = strtok(str, sep); cp; cp = strtok(NULL, sep)) {
                Lst_Append(lp, cp);
@@ -1318,7 +1319,7 @@
         * since these makefiles do not come from the command line.  They
         * also have different semantics in that only the first file that
         * is found is processed.  See ReadAllMakefiles. */
-       (void)str2Lst_Append(opts.makefiles, prefs, NULL);
+       (void)str2Lst_Append(opts.makefiles, prefs);
 
        for (ln = opts.makefiles->first; ln != NULL; ln = ln->next)
                if (ReadMakefile(ln->datum) == 0)
diff -r 1a6d8c30c806 -r 6cfc23a0c67a usr.bin/make/make.h
--- a/usr.bin/make/make.h       Sat Nov 14 17:39:14 2020 +0000
+++ b/usr.bin/make/make.h       Sat Nov 14 17:39:59 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.207 2020/11/14 15:58:01 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.208 2020/11/14 17:39:59 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -654,7 +654,7 @@
 void Main_ExportMAKEFLAGS(Boolean);
 Boolean Main_SetObjdir(Boolean, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
 int mkTempFile(const char *, char **);
-int str2Lst_Append(StringList *, char *, const char *);
+int str2Lst_Append(StringList *, char *);
 void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *);
 Boolean GNode_ShouldExecute(GNode *gn);
 
diff -r 1a6d8c30c806 -r 6cfc23a0c67a usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Sat Nov 14 17:39:14 2020 +0000
+++ b/usr.bin/make/meta.c       Sat Nov 14 17:39:59 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.141 2020/11/08 15:07:37 rillig Exp $ */
+/*      $NetBSD: meta.c,v 1.142 2020/11/14 17:39:59 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -633,7 +633,7 @@
     (void)Var_Subst("${.MAKE.META.BAILIWICK:O:u:tA}",
                    VAR_GLOBAL, VARE_WANTRES, &metaBailiwickStr);
     /* TODO: handle errors */
-    str2Lst_Append(metaBailiwick, metaBailiwickStr, NULL);
+    str2Lst_Append(metaBailiwick, metaBailiwickStr);
     /*
      * We ignore any paths that start with ${.MAKE.META.IGNORE_PATHS}
      */
@@ -643,7 +643,7 @@
     (void)Var_Subst("${" MAKE_META_IGNORE_PATHS ":O:u:tA}",
                    VAR_GLOBAL, VARE_WANTRES, &metaIgnorePathsStr);
     /* TODO: handle errors */
-    str2Lst_Append(metaIgnorePaths, metaIgnorePathsStr, NULL);
+    str2Lst_Append(metaIgnorePaths, metaIgnorePathsStr);
 
     /*
      * We ignore any paths that match ${.MAKE.META.IGNORE_PATTERNS}



Home | Main Index | Thread Index | Old Index