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): rename CondLexer.condPushBack to curr



details:   https://anonhg.NetBSD.org/src/rev/fdd460a6b002
branches:  trunk
changeset: 943720:fdd460a6b002
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Sep 08 18:06:27 2020 +0000

description:
make(1): rename CondLexer.condPushBack to curr

This variable has some context information from the struct now,
therefore its name can be shorter.

diffstat:

 usr.bin/make/cond.c |  29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diffs (94 lines):

diff -r b03ac9373a10 -r fdd460a6b002 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Tue Sep 08 17:55:23 2020 +0000
+++ b/usr.bin/make/cond.c       Tue Sep 08 18:06:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.114 2020/09/08 17:55:23 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.115 2020/09/08 18:06:27 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.114 2020/09/08 17:55:23 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.115 2020/09/08 18:06:27 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.114 2020/09/08 17:55:23 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.115 2020/09/08 18:06:27 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -139,8 +139,7 @@
 typedef struct {
     const struct If *if_info;  /* Info for current statement */
     const char *condExpr;      /* The expression to parse */
-    Token condPushBack;                /* Single push-back token used in
-                                * parsing */
+    Token curr;                        /* Single push-back token used in parsing */
 } CondLexer;
 
 static Token CondE(CondLexer *lex, Boolean);
@@ -164,12 +163,14 @@
     return strncmp(str, tok, len) == 0 && !isalpha((unsigned char)str[len]);
 }
 
-/* Push back the most recent token read. We only need one level of
- * this, so the thing is just stored in 'condPushback'. */
+/* Push back the most recent token read. We only need one level of this. */
 static void
-CondPushBack(CondLexer *lex, Token t)
+CondLexer_PushBack(CondLexer *lex, Token t)
 {
-    lex->condPushBack = t;
+    assert(lex->curr == TOK_NONE);
+    assert(t != TOK_NONE);
+
+    lex->curr = t;
 }
 
 /* Parse the argument of a built-in function.
@@ -799,9 +800,9 @@
 {
     Token t;
 
-    t = lex->condPushBack;
+    t = lex->curr;
     if (t != TOK_NONE) {
-       lex->condPushBack = TOK_NONE;
+       lex->curr = TOK_NONE;
        return t;
     }
 
@@ -942,7 +943,7 @@
            /*
             * F -> T
             */
-           CondPushBack(lex, o);
+           CondLexer_PushBack(lex, o);
        }
     }
     return l;
@@ -989,7 +990,7 @@
            /*
             * E -> F
             */
-           CondPushBack(lex, o);
+           CondLexer_PushBack(lex, o);
        }
     }
     return l;
@@ -1054,7 +1055,7 @@
 
     lex.if_info = info;
     lex.condExpr = line;
-    lex.condPushBack = TOK_NONE;
+    lex.curr = TOK_NONE;
 
     rval = do_Cond_EvalExpression(&lex, value);
 



Home | Main Index | Thread Index | Old Index