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 repetetive code in ParseDirective



details:   https://anonhg.NetBSD.org/src/rev/5f44e6791908
branches:  trunk
changeset: 1027635:5f44e6791908
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Dec 14 01:18:14 2021 +0000

description:
make: condense repetetive code in ParseDirective

No functional change.

diffstat:

 usr.bin/make/parse.c |  36 ++++++++++++++----------------------
 1 files changed, 14 insertions(+), 22 deletions(-)

diffs (66 lines):

diff -r 880b7f83c756 -r 5f44e6791908 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Tue Dec 14 01:00:04 2021 +0000
+++ b/usr.bin/make/parse.c      Tue Dec 14 01:18:14 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.580 2021/12/14 00:45:11 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.581 2021/12/14 01:18:14 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.580 2021/12/14 00:45:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.581 2021/12/14 01:18:14 rillig Exp $");
 
 /* types and constants */
 
@@ -2988,35 +2988,27 @@
        pp_skip_whitespace(&cp);
        arg = cp;
 
-       if (Substring_Equals(dir, "undef")) {
+       if (Substring_Equals(dir, "undef"))
                Var_Undef(arg);
-               return true;
-       } else if (Substring_Equals(dir, "export")) {
+       else if (Substring_Equals(dir, "export"))
                Var_Export(VEM_PLAIN, arg);
-               return true;
-       } else if (Substring_Equals(dir, "export-env")) {
+       else if (Substring_Equals(dir, "export-env"))
                Var_Export(VEM_ENV, arg);
-               return true;
-       } else if (Substring_Equals(dir, "export-literal")) {
+       else if (Substring_Equals(dir, "export-literal"))
                Var_Export(VEM_LITERAL, arg);
-               return true;
-       } else if (Substring_Equals(dir, "unexport")) {
+       else if (Substring_Equals(dir, "unexport"))
                Var_UnExport(false, arg);
-               return true;
-       } else if (Substring_Equals(dir, "unexport-env")) {
+       else if (Substring_Equals(dir, "unexport-env"))
                Var_UnExport(true, arg);
-               return true;
-       } else if (Substring_Equals(dir, "info")) {
+       else if (Substring_Equals(dir, "info"))
                ParseMessage(PARSE_INFO, "info", arg);
-               return true;
-       } else if (Substring_Equals(dir, "warning")) {
+       else if (Substring_Equals(dir, "warning"))
                ParseMessage(PARSE_WARNING, "warning", arg);
-               return true;
-       } else if (Substring_Equals(dir, "error")) {
+       else if (Substring_Equals(dir, "error"))
                ParseMessage(PARSE_FATAL, "error", arg);
-               return true;
-       }
-       return false;
+       else
+               return false;
+       return true;
 }
 
 static bool



Home | Main Index | Thread Index | Old Index