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): avoid negated conditions in DirExpandC...



details:   https://anonhg.NetBSD.org/src/rev/8796377d77ed
branches:  trunk
changeset: 974830:8796377d77ed
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Aug 13 03:07:49 2020 +0000

description:
make(1): avoid negated conditions in DirExpandCurly

diffstat:

 usr.bin/make/dir.c |  18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diffs (60 lines):

diff -r 7704aef25585 -r 8796377d77ed usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Thu Aug 13 03:00:44 2020 +0000
+++ b/usr.bin/make/dir.c        Thu Aug 13 03:07:49 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $  */
+/*     $NetBSD: dir.c,v 1.91 2020/08/13 03:07:49 rillig Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.91 2020/08/13 03:07:49 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c      8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.91 2020/08/13 03:07:49 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -651,11 +651,15 @@
     return 0;
 }
 
+/* Find the next closing brace in the string, taking nested braces into
+ * account. */
 static const char *
 closing_brace(const char *p)
 {
     int nest = 0;
-    while (*p != '\0' && !(*p == '}' && nest == 0)) {
+    while (*p != '\0') {
+        if (*p == '}' && nest == 0)
+           break;
        if (*p == '{')
            nest++;
        if (*p == '}')
@@ -665,11 +669,15 @@
     return p;
 }
 
+/* Find the next closing brace or comma in the string, taking nested braces
+ * into account. */
 static const char *
 separator_comma(const char *p)
 {
     int nest = 0;
-    while (*p != '\0' && !((*p == '}' || *p == ',') && nest == 0)) {
+    while (*p != '\0') {
+        if ((*p == '}' || *p == ',') && nest == 0)
+           break;
        if (*p == '{')
            nest++;
        if (*p == '}')



Home | Main Index | Thread Index | Old Index