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): improve documentation of Var_Parse and...



details:   https://anonhg.NetBSD.org/src/rev/0228e149b305
branches:  trunk
changeset: 937072:0228e149b305
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 08 13:31:24 2020 +0000

description:
make(1): improve documentation of Var_Parse and reorder conditions

diffstat:

 usr.bin/make/var.c |  17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diffs (66 lines):

diff -r 38500f3808d7 -r 0228e149b305 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Aug 08 13:29:09 2020 +0000
+++ b/usr.bin/make/var.c        Sat Aug 08 13:31:24 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.428 2020/08/08 13:27:42 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.429 2020/08/08 13:31:24 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.428 2020/08/08 13:27:42 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.429 2020/08/08 13:31:24 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.428 2020/08/08 13:27:42 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.429 2020/08/08 13:31:24 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3273,7 +3273,7 @@
  *     freePtr         OUT: Non-NULL if caller should free *freePtr
  *
  * Results:
- *     The (possibly-modified) value of the variable or var_Error if the
+ *     The value of the variable expression or var_Error if the
  *     specification is invalid. The length of the specification is
  *     placed in *lengthPtr (for invalid specifications, this is just
  *     2...?).
@@ -3281,8 +3281,7 @@
  *     should pass to free() to free memory used by the result.
  *
  * Side Effects:
- *     None.
- *
+ *     Any effects from the modifiers, such as :!cmd! or ::=value.
  *-----------------------------------------------------------------------
  */
 /* coverity[+alloc : arg-*4] */
@@ -3292,9 +3291,9 @@
 {
     const char *tstr;          /* Pointer into str */
     Boolean     haveModifier;  /* TRUE if have modifiers for the variable */
-    char        startc;        /* Starting character when variable in parens
+    char        startc;        /* Starting character if variable in parens
                                 * or braces */
-    char        endc;          /* Ending character when variable in parens
+    char        endc;          /* Ending character if variable in parens
                                 * or braces */
     Boolean     dynamic;       /* TRUE if the variable is local and we're
                                 * expanding it in a non-local context. This
@@ -3378,7 +3377,7 @@
                if (--depth == 0)
                    break;
            }
-           if (depth == 1 && *tstr == ':')
+           if (*tstr == ':' && depth == 1)
                break;
            /* A variable inside a variable, expand. */
            if (*tstr == '$') {



Home | Main Index | Thread Index | Old Index