Module Name:    src
Committed By:   rillig
Date:           Sat Aug  1 09:55:00 UTC 2020

Modified Files:
        src/usr.bin/make: arch.c compat.c cond.c job.c main.c make.c
            make_malloc.h meta.c parse.c suff.c trace.c

Log Message:
make(1): avoid calls to free(3) in the common case of a NULL pointer


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/arch.c
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/make/compat.c
cvs rdiff -u -r1.83 -r1.84 src/usr.bin/make/cond.c
cvs rdiff -u -r1.203 -r1.204 src/usr.bin/make/job.c
cvs rdiff -u -r1.289 -r1.290 src/usr.bin/make/main.c
cvs rdiff -u -r1.102 -r1.103 src/usr.bin/make/make.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/make_malloc.h
cvs rdiff -u -r1.90 -r1.91 src/usr.bin/make/meta.c
cvs rdiff -u -r1.244 -r1.245 src/usr.bin/make/parse.c
cvs rdiff -u -r1.91 -r1.92 src/usr.bin/make/suff.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/trace.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/arch.c
diff -u src/usr.bin/make/arch.c:1.78 src/usr.bin/make/arch.c:1.79
--- src/usr.bin/make/arch.c:1.78	Fri Jul 31 16:26:16 2020
+++ src/usr.bin/make/arch.c	Sat Aug  1 09:55:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.78 2020/07/31 16:26:16 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.79 2020/08/01 09:55:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.78 2020/07/31 16:26:16 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.79 2020/08/01 09:55:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.78 2020/07/31 16:26:16 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.79 2020/08/01 09:55:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1010,8 +1010,8 @@ Arch_Touch(GNode *gn)
 			  Var_Value(MEMBER, gn, &p2),
 			  &arh, "r+");
 
-    free(p1);
-    free(p2);
+    bmake_free(p1);
+    bmake_free(p2);
 
     snprintf(arh.ar_date, sizeof(arh.ar_date), "%-12ld", (long) now);
 
@@ -1092,8 +1092,8 @@ Arch_MTime(GNode *gn)
 			     Var_Value(MEMBER, gn, &p2),
 			     TRUE);
 
-    free(p1);
-    free(p2);
+    bmake_free(p1);
+    bmake_free(p2);
 
     if (arhPtr != NULL) {
 	modTime = (time_t)strtol(arhPtr->ar_date, NULL, 10);

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.116 src/usr.bin/make/compat.c:1.117
--- src/usr.bin/make/compat.c:1.116	Sat Aug  1 09:25:36 2020
+++ src/usr.bin/make/compat.c	Sat Aug  1 09:55:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.116 2020/08/01 09:25:36 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.117 2020/08/01 09:55:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.116 2020/08/01 09:25:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.117 2020/08/01 09:55:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.116 2020/08/01 09:25:36 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.117 2020/08/01 09:55:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -133,7 +133,7 @@ CompatDeleteTarget(GNode *gn)
 	    Error("*** %s removed", file);
 	}
 
-	free(p1);
+	bmake_free(p1);
     }
 }
 
@@ -548,7 +548,7 @@ Compat_Make(void *gnp, void *pgnp)
 	if (Lst_Member(gn->iParents, pgn) != NULL) {
 	    char *p1;
 	    Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn);
-	    free(p1);
+	    bmake_free(p1);
 	}
 
 	/*
@@ -652,7 +652,7 @@ Compat_Make(void *gnp, void *pgnp)
 	if (Lst_Member(gn->iParents, pgn) != NULL) {
 	    char *p1;
 	    Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn);
-	    free(p1);
+	    bmake_free(p1);
 	}
 	switch(gn->made) {
 	    case BEINGMADE:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.83 src/usr.bin/make/cond.c:1.84
--- src/usr.bin/make/cond.c:1.83	Sat Aug  1 09:30:17 2020
+++ src/usr.bin/make/cond.c	Sat Aug  1 09:55:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.83 2020/08/01 09:30:17 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.84 2020/08/01 09:55:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.83 2020/08/01 09:30:17 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.84 2020/08/01 09:55:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.83 2020/08/01 09:30:17 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.84 2020/08/01 09:55:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -336,7 +336,7 @@ CondDoDefined(int argLen MAKE_ATTR_UNUSE
 {
     char *freeIt;
     Boolean result = Var_Value(arg, VAR_CMD, &freeIt) != NULL;
-    free(freeIt);
+    bmake_free(freeIt);
     return result;
 }
 

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.203 src/usr.bin/make/job.c:1.204
--- src/usr.bin/make/job.c:1.203	Tue Jul 28 16:42:22 2020
+++ src/usr.bin/make/job.c	Sat Aug  1 09:55:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.203 2020/07/28 16:42:22 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.204 2020/08/01 09:55:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.203 2020/07/28 16:42:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.204 2020/08/01 09:55:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.203 2020/07/28 16:42:22 rillig Exp $");
+__RCSID("$NetBSD: job.c,v 1.204 2020/08/01 09:55:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1258,7 +1258,7 @@ Job_CheckCommands(GNode *gn, void (*abor
 	     */
 	    Make_HandleUse(DEFAULT, gn);
 	    Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), gn);
-	    free(p1);
+	    bmake_free(p1);
 	} else if (Dir_MTime(gn, 0) == 0 && (gn->type & OP_SPECIAL) == 0) {
 	    /*
 	     * The node wasn't the target of an operator we have no .DEFAULT

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.289 src/usr.bin/make/main.c:1.290
--- src/usr.bin/make/main.c:1.289	Sat Aug  1 09:25:36 2020
+++ src/usr.bin/make/main.c	Sat Aug  1 09:55:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.289 2020/08/01 09:25:36 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.290 2020/08/01 09:55:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.289 2020/08/01 09:25:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.290 2020/08/01 09:55:00 rillig 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.289 2020/08/01 09:25:36 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.290 2020/08/01 09:55:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -765,7 +765,7 @@ Main_SetVarObjdir(const char *var, const
 	char *path_freeIt;
 	const char *path = Var_Value(var, VAR_CMD, &path_freeIt);
 	if (path == NULL || path[0] == '\0') {
-		free(path_freeIt);
+		bmake_free(path_freeIt);
 		return FALSE;
 	}
 
@@ -778,8 +778,8 @@ Main_SetVarObjdir(const char *var, const
 
 	(void)Main_SetObjdir("%s%s", xpath, suffix);
 
-	free(xpath_freeIt);
-	free(path_freeIt);
+	bmake_free(xpath_freeIt);
+	bmake_free(path_freeIt);
 	return TRUE;
 }
 
@@ -887,7 +887,7 @@ doPrintVars(void)
 			value = Var_Value(var, VAR_GLOBAL, &p1);
 		}
 		printf("%s\n", value ? value : "");
-		free(p1);
+		bmake_free(p1);
 	}
 }
 
@@ -1230,8 +1230,8 @@ main(int argc, char **argv)
 					(void)strncpy(curdir, pwd, MAXPATHLEN);
 			}
 		}
-		free(ptmp1);
-		free(ptmp2);
+		bmake_free(ptmp1);
+		bmake_free(ptmp2);
 	}
 #endif
 	Var_Set(".CURDIR", curdir, VAR_GLOBAL);
@@ -1369,7 +1369,7 @@ main(int argc, char **argv)
 	MakeMode(NULL);
 
 	Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1), VAR_GLOBAL);
-	free(p1);
+	bmake_free(p1);
 
 	if (!forceJobs && !compatMake &&
 	    Var_Exists(".MAKE.JOBS", VAR_GLOBAL)) {
@@ -1991,7 +1991,7 @@ cached_realpath(const char *pathname, ch
 	Var_Set(pathname, rp, cache);
     } /* else should we negative-cache? */
 
-    free(cp);
+    bmake_free(cp);
     return rp ? resolved : NULL;
 }
 

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.102 src/usr.bin/make/make.c:1.103
--- src/usr.bin/make/make.c:1.102	Sat Aug  1 09:25:36 2020
+++ src/usr.bin/make/make.c	Sat Aug  1 09:55:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.102 2020/08/01 09:25:36 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.103 2020/08/01 09:55:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: make.c,v 1.102 2020/08/01 09:25:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.103 2020/08/01 09:55:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)make.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: make.c,v 1.102 2020/08/01 09:25:36 rillig Exp $");
+__RCSID("$NetBSD: make.c,v 1.103 2020/08/01 09:55:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -691,7 +691,7 @@ Make_Update(GNode *cgn)
     checked++;
 
     cname = Var_Value(TARGET, cgn, &p1);
-    free(p1);
+    bmake_free(p1);
 
     if (DEBUG(MAKE))
 	fprintf(debug_file, "Make_Update: %s%s\n", cgn->name, cgn->cohort_num);
@@ -836,7 +836,7 @@ Make_Update(GNode *cgn)
 		    Var_Set(PREFIX, cpref, pgn);
 	    }
 	}
-	free(p1);
+	bmake_free(p1);
 	Lst_Close(cgn->iParents);
     }
 }
@@ -904,7 +904,7 @@ MakeAddAllSrc(void *cgnp, void *pgnp)
 	}
 	if (allsrc != NULL)
 		Var_Append(ALLSRC, allsrc, pgn);
-	free(p2);
+	bmake_free(p2);
 	if (pgn->type & OP_JOIN) {
 	    if (cgn->made == MADE) {
 		Var_Append(OODATE, child, pgn);
@@ -930,7 +930,7 @@ MakeAddAllSrc(void *cgnp, void *pgnp)
 	     */
 	    Var_Append(OODATE, child, pgn);
 	}
-	free(p1);
+	bmake_free(p1);
     }
     return 0;
 }
@@ -976,7 +976,7 @@ Make_DoAllVar(GNode *gn)
     if (gn->type & OP_JOIN) {
 	char *p1;
 	Var_Set(TARGET, Var_Value(ALLSRC, gn, &p1), gn);
-	free(p1);
+	bmake_free(p1);
     }
     gn->flags |= DONE_ALLSRC;
 }

Index: src/usr.bin/make/make_malloc.h
diff -u src/usr.bin/make/make_malloc.h:1.4 src/usr.bin/make/make_malloc.h:1.5
--- src/usr.bin/make/make_malloc.h:1.4	Sat Jan 24 14:43:29 2009
+++ src/usr.bin/make/make_malloc.h	Sat Aug  1 09:55:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make_malloc.h,v 1.4 2009/01/24 14:43:29 dsl Exp $	*/
+/*	$NetBSD: make_malloc.h,v 1.5 2020/08/01 09:55:00 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -39,3 +39,15 @@ char *bmake_strndup(const char *, size_t
 #define bmake_strndup(x,y)      estrndup(x,y)
 #endif
 
+/* Thin wrapper around free(3) to avoid the extra function call in case
+ * p is NULL, which on x86_64 costs about 12 machine instructions.
+ * Other platforms are similarly affected.
+ *
+ * The case of a NULL pointer happens especially often after Var_Value,
+ * since only environment variables need to be freed, but not others. */
+static inline void
+bmake_free(void *p)
+{
+    if (p != NULL)
+        free(p);
+}

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.90 src/usr.bin/make/meta.c:1.91
--- src/usr.bin/make/meta.c:1.90	Sat Aug  1 09:25:36 2020
+++ src/usr.bin/make/meta.c	Sat Aug  1 09:55:00 2020
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.90 2020/08/01 09:25:36 rillig Exp $ */
+/*      $NetBSD: meta.c,v 1.91 2020/08/01 09:55:00 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -542,7 +542,7 @@ meta_create(BuildMon *pbm, GNode *gn)
     }
  out:
     for (i--; i >= 0; i--) {
-	free(p[i]);
+	bmake_free(p[i]);
     }
 
     return mf.fp;
@@ -649,12 +649,12 @@ meta_mode_init(const char *make_mode)
     cp = NULL;
     if (Var_Value(MAKE_META_IGNORE_PATTERNS, VAR_GLOBAL, &cp)) {
 	metaIgnorePatterns = TRUE;
-	free(cp);
+	bmake_free(cp);
     }
     cp = NULL;
     if (Var_Value(MAKE_META_IGNORE_FILTER, VAR_GLOBAL, &cp)) {
 	metaIgnoreFilter = TRUE;
-	free(cp);
+	bmake_free(cp);
     }
 }
 
@@ -1246,12 +1246,12 @@ meta_oodate(GNode *gn, Boolean oodate)
 			ldir = Var_Value(ldir_vname, VAR_GLOBAL, &tp);
 			if (ldir) {
 			    strlcpy(latestdir, ldir, sizeof(latestdir));
-			    free(tp);
+			    bmake_free(tp);
 			}
 			ldir = Var_Value(lcwd_vname, VAR_GLOBAL, &tp);
 			if (ldir) {
 			    strlcpy(lcwd, ldir, sizeof(lcwd));
-			    free(tp);
+			    bmake_free(tp);
 			}
 		    }
 		    /* Skip past the pid. */
@@ -1630,12 +1630,12 @@ meta_oodate(GNode *gn, Boolean oodate)
 	 */
 	Var_Delete(OODATE, gn);
 	Var_Set(OODATE, Var_Value(ALLSRC, gn, &cp), gn);
-	free(cp);
+	bmake_free(cp);
     }
 
  oodate_out:
     for (i--; i >= 0; i--) {
-	free(pa[i]);
+	bmake_free(pa[i]);
     }
     return oodate;
 }

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.244 src/usr.bin/make/parse.c:1.245
--- src/usr.bin/make/parse.c:1.244	Sat Aug  1 09:25:36 2020
+++ src/usr.bin/make/parse.c	Sat Aug  1 09:55:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.244 2020/08/01 09:25:36 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.245 2020/08/01 09:55:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.244 2020/08/01 09:25:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.245 2020/08/01 09:55:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.244 2020/08/01 09:25:36 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.245 2020/08/01 09:55:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -699,8 +699,8 @@ ParseVErrorInternal(FILE *f, const char 
 					fname = cfname;
 			}
 			(void)fprintf(f, "%s/%s", dir, fname);
-			free(cp2);
-			free(cp);
+			bmake_free(cp2);
+			bmake_free(cp);
 		} else
 			(void)fprintf(f, "%s", cfname);
 
@@ -2376,8 +2376,8 @@ ParseSetIncludedFile(void)
 	fprintf(debug_file, "%s: ${.INCLUDEDFROMDIR} = `%s' "
 	    "${.INCLUDEDFROMFILE} = `%s'\n", __func__, pd, pf);
 
-    free(pf_freeIt);
-    free(pd_freeIt);
+    bmake_free(pf_freeIt);
+    bmake_free(pd_freeIt);
 }
 /*-
  *---------------------------------------------------------------------
@@ -2447,7 +2447,7 @@ ParseTrackInput(const char *name)
     }
     Var_Append (MAKE_MAKEFILES, name, VAR_GLOBAL);
  cleanup:
-    free(fp);
+    bmake_free(fp);
 }
 
 

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.91 src/usr.bin/make/suff.c:1.92
--- src/usr.bin/make/suff.c:1.91	Tue Jul 28 16:42:22 2020
+++ src/usr.bin/make/suff.c	Sat Aug  1 09:55:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.91 2020/07/28 16:42:22 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.92 2020/08/01 09:55:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.91 2020/07/28 16:42:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.92 2020/08/01 09:55:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.91 2020/07/28 16:42:22 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.92 2020/08/01 09:55:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1942,7 +1942,7 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
     for (i = (sizeof(copy)/sizeof(copy[0]))-1; i >= 0; i--) {
 	char *p1;
 	Var_Set(copy[i], Var_Value(copy[i], mem, &p1), gn);
-	free(p1);
+	bmake_free(p1);
 
     }
 

Index: src/usr.bin/make/trace.c
diff -u src/usr.bin/make/trace.c:1.13 src/usr.bin/make/trace.c:1.14
--- src/usr.bin/make/trace.c:1.13	Sat Aug  1 09:25:36 2020
+++ src/usr.bin/make/trace.c	Sat Aug  1 09:55:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trace.c,v 1.13 2020/08/01 09:25:36 rillig Exp $	*/
+/*	$NetBSD: trace.c,v 1.14 2020/08/01 09:55:00 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,11 +31,11 @@
 
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: trace.c,v 1.13 2020/08/01 09:25:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: trace.c,v 1.14 2020/08/01 09:55:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: trace.c,v 1.13 2020/08/01 09:25:36 rillig Exp $");
+__RCSID("$NetBSD: trace.c,v 1.14 2020/08/01 09:55:00 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -77,10 +77,10 @@ static const char *evname[] = {
 void
 Trace_Init(const char *pathname)
 {
-	char *p1;
 	if (pathname != NULL) {
 		trpid = getpid();
-		trwd = Var_Value(".CURDIR", VAR_GLOBAL, &p1);
+		char *dontFreeIt;
+		trwd = Var_Value(".CURDIR", VAR_GLOBAL, &dontFreeIt);
 
 		trfile = fopen(pathname, "a");
 	}

Reply via email to