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 visual clutter from VarFind



details:   https://anonhg.NetBSD.org/src/rev/d911f1dfdd8e
branches:  trunk
changeset: 974538:d911f1dfdd8e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 02 16:06:49 2020 +0000

description:
make(1): remove visual clutter from VarFind

Having fewer { else } around makes the return statements easier to find.

diffstat:

 usr.bin/make/var.c |  36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diffs (85 lines):

diff -r dad0a8821a69 -r d911f1dfdd8e usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Aug 02 15:26:49 2020 +0000
+++ b/usr.bin/make/var.c        Sun Aug 02 16:06:49 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.398 2020/08/02 15:26:49 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.399 2020/08/02 16:06:49 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.398 2020/08/02 15:26:49 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.399 2020/08/02 16:06:49 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.398 2020/08/02 15:26:49 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.399 2020/08/02 16:06:49 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -336,9 +336,9 @@
      */
     Hash_Entry *var = Hash_FindEntry(&ctxt->context, name);
 
-    if (var == NULL && (flags & FIND_CMD) && ctxt != VAR_CMD) {
+    if (var == NULL && (flags & FIND_CMD) && ctxt != VAR_CMD)
        var = Hash_FindEntry(&VAR_CMD->context, name);
-    }
+
     if (!checkEnvFirst && var == NULL && (flags & FIND_GLOBAL) &&
        ctxt != VAR_GLOBAL)
     {
@@ -348,6 +348,7 @@
            var = Hash_FindEntry(&VAR_INTERNAL->context, name);
        }
     }
+
     if (var == NULL && (flags & FIND_ENV)) {
        char *env;
 
@@ -361,26 +362,25 @@
 
            v->flags = VAR_FROM_ENV;
            return v;
-       } else if (checkEnvFirst && (flags & FIND_GLOBAL) &&
-                  ctxt != VAR_GLOBAL)
-       {
+       }
+
+       if (checkEnvFirst && (flags & FIND_GLOBAL) && ctxt != VAR_GLOBAL) {
            var = Hash_FindEntry(&VAR_GLOBAL->context, name);
-           if (var == NULL && ctxt != VAR_INTERNAL) {
+           if (var == NULL && ctxt != VAR_INTERNAL)
                var = Hash_FindEntry(&VAR_INTERNAL->context, name);
-           }
-           if (var == NULL) {
+           if (var == NULL)
                return NULL;
-           } else {
+           else
                return (Var *)Hash_GetValue(var);
-           }
-       } else {
-           return NULL;
        }
-    } else if (var == NULL) {
+
        return NULL;
-    } else {
+    }
+
+    if (var == NULL)
+       return NULL;
+    else
        return (Var *)Hash_GetValue(var);
-    }
 }
 
 /*-



Home | Main Index | Thread Index | Old Index