Module Name:    src
Committed By:   rillig
Date:           Sun Jul 26 19:13:43 UTC 2020

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

Log Message:
make(1): split local variable into two in Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.325 -r1.326 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.325 src/usr.bin/make/var.c:1.326
--- src/usr.bin/make/var.c:1.325	Sun Jul 26 19:11:06 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 19:13:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.325 2020/07/26 19:11:06 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.326 2020/07/26 19:13:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.325 2020/07/26 19:11:06 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.326 2020/07/26 19:13:42 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.325 2020/07/26 19:11:06 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.326 2020/07/26 19:13:42 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3401,7 +3401,6 @@ Var_Parse(const char *str, GNode *ctxt, 
 				 * is done to support dynamic sources. The
 				 * result is just the invocation, unaltered */
     const char	*extramodifiers; /* extra modifiers to apply first */
-    char	 name[2];
 
     *freePtr = NULL;
     extramodifiers = NULL;
@@ -3421,8 +3420,7 @@ Var_Parse(const char *str, GNode *ctxt, 
 	    *lengthPtr = 1;
 	    return var_Error;
 	}
-	name[0] = startc;
-	name[1] = '\0';
+	char name[] = { startc, '\0' };
 
 	v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
 	if (v == NULL) {
@@ -3526,8 +3524,7 @@ Var_Parse(const char *str, GNode *ctxt, 
 	    /*
 	     * Well, it's local -- go look for it.
 	     */
-	    name[0] = varname[0];
-	    name[1] = '\0';
+	    char name[] = {varname[0], '\0' };
 	    v = VarFind(name, ctxt, 0);
 
 	    if (v != NULL) {

Reply via email to