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): add CondLexer_SkipWhitespace



details:   https://anonhg.NetBSD.org/src/rev/39195399fd73
branches:  trunk
changeset: 954709:39195399fd73
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Sep 08 18:10:34 2020 +0000

description:
make(1): add CondLexer_SkipWhitespace

diffstat:

 usr.bin/make/cond.c |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (63 lines):

diff -r b63e1d321200 -r 39195399fd73 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Tue Sep 08 18:06:27 2020 +0000
+++ b/usr.bin/make/cond.c       Tue Sep 08 18:10:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.115 2020/09/08 18:06:27 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.116 2020/09/08 18:10:34 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: cond.c,v 1.115 2020/09/08 18:06:27 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.116 2020/09/08 18:10:34 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.115 2020/09/08 18:06:27 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.116 2020/09/08 18:10:34 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -173,6 +173,13 @@
     lex->curr = t;
 }
 
+static void
+CondLexer_SkipWhitespace(CondLexer *lex)
+{
+    while (isspace((unsigned char)lex->condExpr[0]))
+       lex->condExpr++;
+}
+
 /* Parse the argument of a built-in function.
  *
  * Arguments:
@@ -538,11 +545,7 @@
     if (!lhs)
        goto done;
 
-    /*
-     * Skip whitespace to get to the operator
-     */
-    while (isspace((unsigned char)*lex->condExpr))
-       lex->condExpr++;
+    CondLexer_SkipWhitespace(lex);
 
     /*
      * Make sure the operator is a valid one. If it isn't a
@@ -586,8 +589,7 @@
        goto done;
     }
 
-    while (isspace((unsigned char)*lex->condExpr))
-       lex->condExpr++;
+    CondLexer_SkipWhitespace(lex);
 
     if (*lex->condExpr == '\0') {
        Parse_Error(PARSE_WARNING,



Home | Main Index | Thread Index | Old Index