Module Name:    src
Committed By:   christos
Date:           Sat Jun 17 16:34:08 UTC 2017

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

Log Message:
simplify


To generate a diff of this commit:
cvs rdiff -u -r1.267 -r1.268 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.267 src/usr.bin/make/main.c:1.268
--- src/usr.bin/make/main.c:1.267	Sat Jun 17 11:49:56 2017
+++ src/usr.bin/make/main.c	Sat Jun 17 12:34:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.267 2017/06/17 15:49:56 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.268 2017/06/17 16:34:07 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.267 2017/06/17 15:49:56 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.268 2017/06/17 16:34:07 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.267 2017/06/17 15:49:56 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.268 2017/06/17 16:34:07 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -876,13 +876,12 @@ doPrintVars(void)
 			value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL,
 			    VARF_WANTRES);
 		} else {
-			char *next = var;
-			value = Var_Value(next, VAR_GLOBAL, &p1);
+			value = Var_Value(var, VAR_GLOBAL, &p1);
 			if (*value == '$') {
-				var = value;
-				value = p1 = Var_Subst(NULL, var,
+				value = Var_Subst(NULL, value,
 				    VAR_GLOBAL, VARF_WANTRES);
-				free(var);
+				free(p1);
+				p1 = value;
 			}
 		}
 		printf("%s\n", value ? value : "");

Reply via email to