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): merge duplicate code in is_relpath



details:   https://anonhg.NetBSD.org/src/rev/be765fec89b9
branches:  trunk
changeset: 942426:be765fec89b9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 08 01:43:58 2020 +0000

description:
make(1): merge duplicate code in is_relpath

diffstat:

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

diffs (42 lines):

diff -r eb6fba3c1413 -r be765fec89b9 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sun Nov 08 01:40:01 2020 +0000
+++ b/usr.bin/make/main.c       Sun Nov 08 01:43:58 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.438 2020/11/08 01:40:01 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.439 2020/11/08 01:43:58 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.438 2020/11/08 01:40:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.439 2020/11/08 01:43:58 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -151,7 +151,7 @@
 
 /*
  * For compatibility with the POSIX version of MAKEFLAGS that includes
- * all the options with out -, convert flags to -f -l -a -g -s.
+ * all the options without '-', convert 'flags' to '-f -l -a -g -s'.
  */
 static char *
 explode(const char *flags)
@@ -341,12 +341,10 @@
        cp = path;
        while ((cp = strstr(cp, "/.")) != NULL) {
                cp += 2;
+               if (*cp == '.')
+                   cp++;
                if (cp[0] == '/' || cp[0] == '\0')
                        return TRUE;
-               else if (cp[0] == '.') {
-                       if (cp[1] == '/' || cp[1] == '\0')
-                               return TRUE;
-               }
        }
        return FALSE;
 }



Home | Main Index | Thread Index | Old Index