Module Name: src
Committed By: rillig
Date: Wed Dec 15 11:01:39 UTC 2021
Modified Files:
src/usr.bin/make: main.c make_malloc.h
Log Message:
make: remove bmake_free
It was only used in 2 places, and in both these places, the pointer was
never null.
To generate a diff of this commit:
cvs rdiff -u -r1.544 -r1.545 src/usr.bin/make/main.c
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/make_malloc.h
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.544 src/usr.bin/make/main.c:1.545
--- src/usr.bin/make/main.c:1.544 Wed Dec 15 10:57:01 2021
+++ src/usr.bin/make/main.c Wed Dec 15 11:01:39 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.544 2021/12/15 10:57:01 rillig Exp $ */
+/* $NetBSD: main.c,v 1.545 2021/12/15 11:01:39 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.544 2021/12/15 10:57:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.545 2021/12/15 11:01:39 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -843,7 +843,7 @@ PrintVar(const char *varname, bool expan
(void)Var_Subst(varname, SCOPE_GLOBAL, VARE_WANTRES, &evalue);
/* TODO: handle errors */
printf("%s\n", evalue);
- bmake_free(evalue);
+ free(evalue);
} else if (expandVars) {
char *expr = str_concat3("${", varname, "}");
@@ -852,7 +852,7 @@ PrintVar(const char *varname, bool expan
/* TODO: handle errors */
free(expr);
printf("%s\n", evalue);
- bmake_free(evalue);
+ free(evalue);
} else {
FStr value = Var_Value(SCOPE_GLOBAL, varname);
Index: src/usr.bin/make/make_malloc.h
diff -u src/usr.bin/make/make_malloc.h:1.17 src/usr.bin/make/make_malloc.h:1.18
--- src/usr.bin/make/make_malloc.h:1.17 Wed Dec 15 09:53:41 2021
+++ src/usr.bin/make/make_malloc.h Wed Dec 15 11:01:39 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: make_malloc.h,v 1.17 2021/12/15 09:53:41 rillig Exp $ */
+/* $NetBSD: make_malloc.h,v 1.18 2021/12/15 11:01:39 rillig Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -40,17 +40,3 @@ char *bmake_strldup(const char *, size_t
#endif
char *bmake_strsedup(const char *, const char *) MAKE_ATTR_USE;
-
-/*
- * Thin wrapper around free(3) to avoid the extra function call in case
- * p is NULL, to save a few machine instructions.
- *
- * The case of a NULL pointer happens especially often after Var_Value,
- * since only environment variables need to be freed, but not others.
- */
-MAKE_INLINE void
-bmake_free(void *p)
-{
- if (p != NULL)
- free(p);
-}