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): format code in str.c consistently



details:   https://anonhg.NetBSD.org/src/rev/faca8c1a1435
branches:  trunk
changeset: 936950:faca8c1a1435
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 09 10:24:02 2020 +0000

description:
make(1): format code in str.c consistently

diffstat:

 usr.bin/make/str.c |  41 +++++++++++++++++++++--------------------
 1 files changed, 21 insertions(+), 20 deletions(-)

diffs (101 lines):

diff -r 9983553694d6 -r faca8c1a1435 usr.bin/make/str.c
--- a/usr.bin/make/str.c        Sun Aug 09 09:44:14 2020 +0000
+++ b/usr.bin/make/str.c        Sun Aug 09 10:24:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: str.c,v 1.55 2020/08/03 20:26:09 rillig Exp $  */
+/*     $NetBSD: str.c,v 1.56 2020/08/09 10:24:02 rillig Exp $  */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.55 2020/08/03 20:26:09 rillig Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.56 2020/08/09 10:24:02 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.55 2020/08/03 20:26:09 rillig Exp $");
+__RCSID("$NetBSD: str.c,v 1.56 2020/08/09 10:24:02 rillig Exp $");
 #endif
 #endif                         /* not lint */
 #endif
@@ -140,16 +140,16 @@
  */
 char **
 brk_string(const char *str, int *out_words_len, Boolean expand,
-       char **out_words_buf)
+          char **out_words_buf)
 {
-       size_t str_len;
-       char *words_buf;
-       int words_cap;
-       char **words;
-       int words_len;
-       char inquote;
-       char *word_start;
-       char *word_end;
+       size_t str_len;
+       char *words_buf;
+       int words_cap;
+       char **words;
+       int words_len;
+       char inquote;
+       char *word_start;
+       char *word_end;
        const char *str_p;
 
        /* skip leading space chars. */
@@ -173,7 +173,7 @@
        word_end = words_buf;
        for (str_p = str;; ++str_p) {
                char ch = *str_p;
-               switch(ch) {
+               switch (ch) {
                case '"':
                case '\'':
                        if (inquote) {
@@ -181,9 +181,8 @@
                                        inquote = '\0';
                                else
                                        break;
-                       }
-                       else {
-                               inquote = (char) ch;
+                       } else {
+                               inquote = (char)ch;
                                /* Don't miss "" or '' */
                                if (word_start == NULL && str_p[1] == inquote) {
                                        if (!expand) {
@@ -216,13 +215,14 @@
                         * space and save off a pointer.
                         */
                        if (word_start == NULL)
-                           goto done;
+                               goto done;
 
                        *word_end++ = '\0';
                        if (words_len == words_cap) {
+                               size_t new_size;
                                words_cap *= 2;         /* ramp up fast */
-                               words = (char **)bmake_realloc(words,
-                                   (words_cap + 1) * sizeof(char *));
+                               new_size = (words_cap + 1) * sizeof(char *);
+                               words = bmake_realloc(words, new_size);
                        }
                        words[words_len++] = word_start;
                        word_start = NULL;
@@ -277,7 +277,8 @@
                        word_start = word_end;
                *word_end++ = ch;
        }
-done:  words[words_len] = NULL;
+done:
+       words[words_len] = NULL;
        *out_words_len = words_len;
        *out_words_buf = words_buf;
        return words;



Home | Main Index | Thread Index | Old Index