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(1): remove unreachable code from CondParse...



details:   https://anonhg.NetBSD.org/src/rev/7028cf650707
branches:  trunk
changeset: 956933:7028cf650707
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Nov 10 22:25:38 2020 +0000

description:
make(1): remove unreachable code from CondParser_String

The code that has been removed was not reachable from after the Var_Parse
call.  All branches after the Var_Parse are either freed properly or
return the expanded value.

diffstat:

 usr.bin/make/cond.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (38 lines):

diff -r 46fbca0fb644 -r 7028cf650707 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Tue Nov 10 22:23:37 2020 +0000
+++ b/usr.bin/make/cond.c       Tue Nov 10 22:25:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.202 2020/11/10 20:52:28 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.203 2020/11/10 22:25:38 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.202 2020/11/10 20:52:28 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.203 2020/11/10 22:25:38 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -448,6 +448,8 @@
                if (parseResult & VPR_ANY_MSG)
                    par->printedError = TRUE;
                if (*out_freeIt != NULL) {
+                   /* XXX: Can there be any situation in which a returned
+                    * var_Error requires freeIt? */
                    free(*out_freeIt);
                    *out_freeIt = NULL;
                }
@@ -479,10 +481,6 @@
        default:
            if (strictLHS && !quoted && *start != '$' && !ch_isdigit(*start)) {
                /* lhs must be quoted, a variable reference or number */
-               if (*out_freeIt) {
-                   free(*out_freeIt);
-                   *out_freeIt = NULL;
-               }
                str = NULL;
                goto cleanup;
            }



Home | Main Index | Thread Index | Old Index