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): make brk_string return size_t for the ...



details:   https://anonhg.NetBSD.org/src/rev/293c6f701c29
branches:  trunk
changeset: 975229:293c6f701c29
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 23 18:26:35 2020 +0000

description:
make(1): make brk_string return size_t for the number of words

diffstat:

 usr.bin/make/compat.c  |  12 ++---
 usr.bin/make/for.c     |  18 +++++----
 usr.bin/make/job.c     |  10 ++--
 usr.bin/make/main.c    |  12 +++---
 usr.bin/make/nonints.h |   4 +-
 usr.bin/make/str.c     |  10 ++--
 usr.bin/make/var.c     |  92 +++++++++++++++++++++++++-------------------------
 7 files changed, 79 insertions(+), 79 deletions(-)

diffs (truncated from 536 to 300 lines):

diff -r 77b8a4c5506e -r 293c6f701c29 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sun Aug 23 18:03:35 2020 +0000
+++ b/usr.bin/make/compat.c     Sun Aug 23 18:26:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.127 2020/08/23 10:53:27 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.128 2020/08/23 18:26:35 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.127 2020/08/23 10:53:27 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.128 2020/08/23 18:26:35 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c   8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.127 2020/08/23 10:53:27 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.128 2020/08/23 18:26:35 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -221,8 +221,6 @@
     LstNode      cmdNode;      /* Node where current command is located */
     const char  ** volatile av;        /* Argument vector for thing to exec */
     char       ** volatile mav;/* Copy of the argument vector for freeing */
-    int                  argc;         /* Number of arguments in av or 0 if not
-                                * dynamically allocated */
     Boolean      useShell;     /* TRUE if command should be executed
                                 * using a shell */
     char         * volatile cmd = (char *)cmdp;
@@ -350,15 +348,15 @@
        shargv[shargc++] = cmd;
        shargv[shargc++] = NULL;
        av = shargv;
-       argc = 0;
        bp = NULL;
        mav = NULL;
     } else {
+        size_t argc;
        /*
         * No meta-characters, so no need to exec a shell. Break the command
         * into words to form an argument vector we can execute.
         */
-       mav = brk_string(cmd, &argc, TRUE, &bp);
+       mav = brk_string(cmd, TRUE, &argc, &bp);
        if (mav == NULL) {
                useShell = 1;
                goto again;
diff -r 77b8a4c5506e -r 293c6f701c29 usr.bin/make/for.c
--- a/usr.bin/make/for.c        Sun Aug 23 18:03:35 2020 +0000
+++ b/usr.bin/make/for.c        Sun Aug 23 18:26:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.64 2020/08/22 21:42:38 rillig Exp $  */
+/*     $NetBSD: for.c,v 1.65 2020/08/23 18:26:35 rillig Exp $  */
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -30,14 +30,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: for.c,v 1.64 2020/08/22 21:42:38 rillig Exp $";
+static char rcsid[] = "$NetBSD: for.c,v 1.65 2020/08/23 18:26:35 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)for.c      8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: for.c,v 1.64 2020/08/22 21:42:38 rillig Exp $");
+__RCSID("$NetBSD: for.c,v 1.65 2020/08/23 18:26:35 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -141,11 +141,11 @@
 {
     For *new_for;
     char *ptr = line, *sub;
-    int len;
+    size_t len;
     int escapes;
     unsigned char ch;
     char **words, *word_buf;
-    int n, nwords;
+    size_t nwords;
 
     /* Skip the '.' and any following whitespace */
     for (ptr++; *ptr && isspace((unsigned char)*ptr); ptr++)
@@ -214,11 +214,13 @@
     /*
      * Split into words allowing for quoted strings.
      */
-    words = brk_string(sub, &nwords, FALSE, &word_buf);
+    words = brk_string(sub, FALSE, &nwords, &word_buf);
 
     free(sub);
 
     if (words != NULL) {
+        size_t n;
+
        for (n = 0; n < nwords; n++) {
            ptr = words[n];
            if (!*ptr)
@@ -252,8 +254,8 @@
        if ((len = strlist_num(&new_for->items)) > 0 &&
            len % (n = strlist_num(&new_for->vars))) {
            Parse_Error(PARSE_FATAL,
-                       "Wrong number of words (%d) in .for substitution list"
-                       " with %d vars", len, n);
+                       "Wrong number of words (%zu) in .for substitution list"
+                       " with %zu vars", len, n);
            /*
             * Return 'success' so that the body of the .for loop is
             * accumulated.
diff -r 77b8a4c5506e -r 293c6f701c29 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sun Aug 23 18:03:35 2020 +0000
+++ b/usr.bin/make/job.c        Sun Aug 23 18:26:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.214 2020/08/22 21:42:38 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.215 2020/08/23 18:26:35 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.214 2020/08/22 21:42:38 rillig Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.215 2020/08/23 18:26:35 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c      8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.214 2020/08/22 21:42:38 rillig Exp $");
+__RCSID("$NetBSD: job.c,v 1.215 2020/08/23 18:26:35 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2445,7 +2445,7 @@
 {
     char       **words;
     char       **argv;
-    int                argc;
+    size_t     argc;
     char       *path;
     Shell      newShell;
     Boolean    fullSpec = FALSE;
@@ -2462,7 +2462,7 @@
     /*
      * Parse the specification by keyword
      */
-    words = brk_string(line, &argc, TRUE, &path);
+    words = brk_string(line, TRUE, &argc, &path);
     if (words == NULL) {
        Error("Unterminated quoted string [%s]", line);
        return FAILURE;
diff -r 77b8a4c5506e -r 293c6f701c29 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sun Aug 23 18:03:35 2020 +0000
+++ b/usr.bin/make/main.c       Sun Aug 23 18:26:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.311 2020/08/23 16:58:02 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.312 2020/08/23 18:26:35 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.311 2020/08/23 16:58:02 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.312 2020/08/23 18:26:35 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.311 2020/08/23 16:58:02 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.312 2020/08/23 18:26:35 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -690,7 +690,7 @@
 Main_ParseArgLine(const char *line)
 {
        char **argv;                    /* Manufactured argument vector */
-       int argc;                       /* Number of arguments in argv */
+       size_t argc;                    /* Number of arguments in argv */
        char *args;                     /* Space used by the args */
        char *p1;
        const char *argv0 = Var_Value(".MAKE", VAR_GLOBAL, &p1);
@@ -706,14 +706,14 @@
        buf = str_concat3(argv0, " ", line);
        free(p1);
 
-       argv = brk_string(buf, &argc, TRUE, &args);
+       argv = brk_string(buf, TRUE, &argc, &args);
        if (argv == NULL) {
                Error("Unterminated quoted string [%s]", buf);
                free(buf);
                return;
        }
        free(buf);
-       MainParseArgs(argc, argv);
+       MainParseArgs((int)argc, argv);
 
        free(args);
        free(argv);
diff -r 77b8a4c5506e -r 293c6f701c29 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Sun Aug 23 18:03:35 2020 +0000
+++ b/usr.bin/make/nonints.h    Sun Aug 23 18:26:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.97 2020/08/23 09:28:52 rillig Exp $      */
+/*     $NetBSD: nonints.h,v 1.98 2020/08/23 18:26:35 rillig Exp $      */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -136,7 +136,7 @@
 char *str_concat2(const char *, const char *);
 char *str_concat3(const char *, const char *, const char *);
 char *str_concat4(const char *, const char *, const char *, const char *);
-char **brk_string(const char *, int *, Boolean, char **);
+char **brk_string(const char *, Boolean, size_t *, char **);
 char *Str_FindSubstring(const char *, const char *);
 Boolean Str_Match(const char *, const char *);
 
diff -r 77b8a4c5506e -r 293c6f701c29 usr.bin/make/str.c
--- a/usr.bin/make/str.c        Sun Aug 23 18:03:35 2020 +0000
+++ b/usr.bin/make/str.c        Sun Aug 23 18:26:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: str.c,v 1.61 2020/08/23 18:03:35 rillig Exp $  */
+/*     $NetBSD: str.c,v 1.62 2020/08/23 18:26:35 rillig Exp $  */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.61 2020/08/23 18:03:35 rillig Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.62 2020/08/23 18:26:35 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char     sccsid[] = "@(#)str.c  5.8 (Berkeley) 6/1/90";
 #else
-__RCSID("$NetBSD: str.c,v 1.61 2020/08/23 18:03:35 rillig Exp $");
+__RCSID("$NetBSD: str.c,v 1.62 2020/08/23 18:26:35 rillig Exp $");
 #endif
 #endif                         /* not lint */
 #endif
@@ -142,8 +142,8 @@
  *     Number of words in *out_words_len.
  */
 char **
-brk_string(const char *str, int *out_words_len, Boolean expand,
-          char **out_words_buf)
+brk_string(const char *str, Boolean expand,
+          size_t *out_words_len, char **out_words_buf)
 {
        size_t str_len;
        char *words_buf;
diff -r 77b8a4c5506e -r 293c6f701c29 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Aug 23 18:03:35 2020 +0000
+++ b/usr.bin/make/var.c        Sun Aug 23 18:26:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.464 2020/08/23 10:27:22 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.465 2020/08/23 18:26:35 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.464 2020/08/23 10:27:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.465 2020/08/23 18:26:35 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.464 2020/08/23 10:27:22 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.465 2020/08/23 18:26:35 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -608,10 +608,10 @@
     if (*val) {
        char **av;



Home | Main Index | Thread Index | Old Index