Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make: remove bmake_free



details:   https://anonhg.NetBSD.org/src/rev/ba68c2ac6ad8
branches:  trunk
changeset: 1027680:ba68c2ac6ad8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Dec 15 11:01:39 2021 +0000

description:
make: remove bmake_free

It was only used in 2 places, and in both these places, the pointer was
never null.

diffstat:

 usr.bin/make/main.c        |   8 ++++----
 usr.bin/make/make_malloc.h |  16 +---------------
 2 files changed, 5 insertions(+), 19 deletions(-)

diffs (63 lines):

diff -r a46cd206f073 -r ba68c2ac6ad8 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Wed Dec 15 10:57:01 2021 +0000
+++ b/usr.bin/make/main.c       Wed Dec 15 11:01:39 2021 +0000
@@ -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 @@
                (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 @@
                /* TODO: handle errors */
                free(expr);
                printf("%s\n", evalue);
-               bmake_free(evalue);
+               free(evalue);
 
        } else {
                FStr value = Var_Value(SCOPE_GLOBAL, varname);
diff -r a46cd206f073 -r ba68c2ac6ad8 usr.bin/make/make_malloc.h
--- a/usr.bin/make/make_malloc.h        Wed Dec 15 10:57:01 2021 +0000
+++ b/usr.bin/make/make_malloc.h        Wed Dec 15 11:01:39 2021 +0000
@@ -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 @@
 #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);
-}



Home | Main Index | Thread Index | Old Index