Module Name:    src
Committed By:   rillig
Date:           Sat Aug 22 17:32:55 UTC 2020

Modified Files:
        src/usr.bin/make: var.c

Log Message:
make(1): fix documentation of Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.454 -r1.455 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.454 src/usr.bin/make/var.c:1.455
--- src/usr.bin/make/var.c:1.454	Thu Aug 20 07:15:52 2020
+++ src/usr.bin/make/var.c	Sat Aug 22 17:32:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.454 2020/08/20 07:15:52 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.455 2020/08/22 17:32:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.454 2020/08/20 07:15:52 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.455 2020/08/22 17:32:55 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.454 2020/08/20 07:15:52 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.455 2020/08/22 17:32:55 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3323,12 +3323,14 @@ VarIsDynamic(GNode *ctxt, const char *va
  *	freePtr		OUT: Non-NULL if caller should free *freePtr
  *
  * Results:
- *	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...?).
- *	If *freePtr is non-NULL then it's a pointer that the caller
- *	should pass to free() to free memory used by the result.
+ *	Returns the value of the variable expression.
+ *	var_Error if there was a parse error and VARE_UNDEFERR was set.
+ *	varNoError if there was a parse error and VARE_UNDEFERR was not set.
+ *
+ *	Parsing should continue at str + *lengthPtr.
+ *
+ *	After using the returned value, *freePtr must be freed, preferably
+ *	using bmake_free since it is NULL in most cases.
  *
  * Side Effects:
  *	Any effects from the modifiers, such as :!cmd! or ::=value.
@@ -3686,12 +3688,6 @@ Var_Subst(const char *str, GNode *ctxt, 
 	    void *freeIt;
 	    const char *val = Var_Parse(str, ctxt, eflags, &length, &freeIt);
 
-	    /*
-	     * When we come down here, val should either point to the
-	     * value of this variable, suitably modified, or be NULL.
-	     * Length should be the total length of the potential
-	     * variable invocation (from $ to end character...)
-	     */
 	    if (val == var_Error || val == varNoError) {
 		/*
 		 * If performing old-time variable substitution, skip over

Reply via email to