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): reorder parameters of condition parsin...



details:   https://anonhg.NetBSD.org/src/rev/0396ce54960c
branches:  trunk
changeset: 938566:0396ce54960c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Sep 11 06:08:10 2020 +0000

description:
make(1): reorder parameters of condition parsing functions

First the subject, then the options, then the output parameters.

diffstat:

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

diffs (95 lines):

diff -r f5a8ba50f82f -r 0396ce54960c usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Fri Sep 11 05:37:40 2020 +0000
+++ b/usr.bin/make/cond.c       Fri Sep 11 06:08:10 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.126 2020/09/11 05:03:20 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.127 2020/09/11 06:08:10 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.126 2020/09/11 05:03:20 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.127 2020/09/11 06:08:10 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.126 2020/09/11 05:03:20 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.127 2020/09/11 06:08:10 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -198,8 +198,8 @@
 /* Parse the argument of a built-in function.
  *
  * Arguments:
- *     *linePtr initially points to the '(', upon successful return points
- *     beyond the ')'.
+ *     *linePtr initially points at the '(', upon successful return points
+ *     right after the ')'.
  *
  *     *out_arg receives the argument as string.
  *
@@ -208,8 +208,8 @@
  *
  * Return the length of the argument. */
 static int
-ParseFuncArg(Boolean doEval, const char **linePtr, char **out_arg,
-            const char *func) {
+ParseFuncArg(const char **linePtr, Boolean doEval, const char *func,
+            char **out_arg) {
     const char *cp;
     Buffer buf;
     int paren_depth;
@@ -685,8 +685,8 @@
 }
 
 static int
-ParseEmptyArg(Boolean doEval, const char **linePtr, char **argPtr,
-             const char *func MAKE_ATTR_UNUSED)
+ParseEmptyArg(const char **linePtr, Boolean doEval,
+             const char *func MAKE_ATTR_UNUSED, char **argPtr)
 {
     void *val_freeIt;
     const char *val;
@@ -730,8 +730,8 @@
     static const struct fn_def {
        const char *fn_name;
        size_t fn_name_len;
-       int (*fn_getarg)(Boolean, const char **, char **, const char *);
-       Boolean (*fn_proc)(int, const char *);
+       int (*fn_parse)(const char **, Boolean, const char *, char **);
+       Boolean (*fn_eval)(int, const char *);
     } fn_defs[] = {
        { "defined",  7, ParseFuncArg,  FuncDefined },
        { "make",     4, ParseFuncArg,  FuncMake },
@@ -758,13 +758,13 @@
        if (*cp != '(')
            break;
 
-       arglen = fn_def->fn_getarg(doEval, &cp, &arg, fn_def->fn_name);
+       arglen = fn_def->fn_parse(&cp, doEval, fn_def->fn_name, &arg);
        if (arglen <= 0) {
            par->p = cp;
            return arglen < 0 ? TOK_ERROR : TOK_FALSE;
        }
        /* Evaluate the argument using the required function. */
-       t = !doEval || fn_def->fn_proc(arglen, arg);
+       t = !doEval || fn_def->fn_eval(arglen, arg);
        free(arg);
        par->p = cp;
        return t;
@@ -783,7 +783,7 @@
      * would be invalid if we did "defined(a)" - so instead treat as an
      * expression.
      */
-    arglen = ParseFuncArg(doEval, &cp, &arg, NULL);
+    arglen = ParseFuncArg(&cp, doEval, NULL, &arg);
     for (cp1 = cp; isspace((unsigned char)*cp1); cp1++)
        continue;
     if (*cp1 == '=' || *cp1 == '!')



Home | Main Index | Thread Index | Old Index