Module Name:    src
Committed By:   rillig
Date:           Tue Oct 27 07:38:08 UTC 2020

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

Log Message:
make(1): use constant string for Var_Subst

The times where Var_Subst needed a modifiable string are long gone.


To generate a diff of this commit:
cvs rdiff -u -r1.398 -r1.399 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.398 src/usr.bin/make/main.c:1.399
--- src/usr.bin/make/main.c:1.398	Tue Oct 27 07:34:36 2020
+++ src/usr.bin/make/main.c	Tue Oct 27 07:38:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.398 2020/10/27 07:34:36 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.399 2020/10/27 07:38:08 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.398 2020/10/27 07:34:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.399 2020/10/27 07:38:08 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -1479,14 +1479,8 @@ main(int argc, char **argv)
 	 */
 	if (Var_Exists("VPATH", VAR_CMD)) {
 		char *vpath, savec;
-		/*
-		 * GCC stores string constants in read-only memory, but
-		 * Var_Subst will want to write this thing, so store it
-		 * in an array
-		 */
-		static char VPATH[] = "${VPATH}";
 
-		(void)Var_Subst(VPATH, VAR_CMD, VARE_WANTRES, &vpath);
+		(void)Var_Subst("${VPATH}", VAR_CMD, VARE_WANTRES, &vpath);
 		/* TODO: handle errors */
 		path = vpath;
 		do {

Reply via email to