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: condense the code for parsing :S and :C m...



details:   https://anonhg.NetBSD.org/src/rev/94206b0ec535
branches:  trunk
changeset: 959438:94206b0ec535
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 14 12:35:27 2021 +0000

description:
make: condense the code for parsing :S and :C modifiers

No functional change.

diffstat:

 usr.bin/make/var.c |  32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)

diffs (66 lines):

diff -r cc42224089c7 -r 94206b0ec535 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Feb 14 12:24:53 2021 +0000
+++ b/usr.bin/make/var.c        Sun Feb 14 12:35:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.810 2021/02/14 12:24:53 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.811 2021/02/14 12:35:27 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.810 2021/02/14 12:24:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.811 2021/02/14 12:35:27 rillig Exp $");
 
 typedef enum VarFlags {
        VAR_NONE        = 0,
@@ -2772,18 +2772,14 @@
 
        oneBigWord = st->oneBigWord;
        for (;; (*pp)++) {
-               switch (**pp) {
-               case 'g':
+               if (**pp == 'g')
                        args.pflags.subGlobal = TRUE;
-                       continue;
-               case '1':
+               else if (**pp == '1')
                        args.pflags.subOnce = TRUE;
-                       continue;
-               case 'W':
+               else if (**pp == 'W')
                        oneBigWord = TRUE;
-                       continue;
-               }
-               break;
+               else
+                       break;
        }
 
        st->newVal = FStr_InitOwn(ModifyWords(val, ModifyWord_Subst, &args,
@@ -2829,18 +2825,14 @@
        args.matched = FALSE;
        oneBigWord = st->oneBigWord;
        for (;; (*pp)++) {
-               switch (**pp) {
-               case 'g':
+               if (**pp == 'g')
                        args.pflags.subGlobal = TRUE;
-                       continue;
-               case '1':
+               else if (**pp == '1')
                        args.pflags.subOnce = TRUE;
-                       continue;
-               case 'W':
+               else if (**pp == 'W')
                        oneBigWord = TRUE;
-                       continue;
-               }
-               break;
+               else
+                       break;
        }
 
        error = regcomp(&args.re, re, REG_EXTENDED);



Home | Main Index | Thread Index | Old Index