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): clean up InitDefSysIncPath



details:   https://anonhg.NetBSD.org/src/rev/2139f0a89ea7
branches:  trunk
changeset: 957029:2139f0a89ea7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 14 18:14:34 2020 +0000

description:
make(1): clean up InitDefSysIncPath

Flipping the arguments to strncmp puts the subject first in the
sentence. Inverting the condition makes the code flow easier to follow.

diffstat:

 usr.bin/make/main.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r 736516ac055f -r 2139f0a89ea7 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Nov 14 18:07:26 2020 +0000
+++ b/usr.bin/make/main.c       Sat Nov 14 18:14:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.463 2020/11/14 18:07:26 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.464 2020/11/14 18:14:34 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.463 2020/11/14 18:07:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.464 2020/11/14 18:14:34 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -1189,14 +1189,14 @@
                        *cp++ = '\0';
 
                /* look for magic parent directory search string */
-               if (strncmp(".../", start, 4) != 0) {
-                       (void)Dir_AddDir(defSysIncPath, start);
-               } else {
+               if (strncmp(start, ".../", 4) == 0) {
                        char *dir = Dir_FindHereOrAbove(curdir, start + 4);
                        if (dir != NULL) {
                                (void)Dir_AddDir(defSysIncPath, dir);
                                free(dir);
                        }
+               } else {
+                       (void)Dir_AddDir(defSysIncPath, start);
                }
        }
 



Home | Main Index | Thread Index | Old Index