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: simplify control flow in CondParser_Compa...



details:   https://anonhg.NetBSD.org/src/rev/753c6a35f9a9
branches:  trunk
changeset: 361124:753c6a35f9a9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Feb 11 21:18:09 2022 +0000

description:
make: simplify control flow in CondParser_Comparison

No functional change.

diffstat:

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

diffs (41 lines):

diff -r be25bcaf87ee -r 753c6a35f9a9 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Fri Feb 11 21:15:25 2022 +0000
+++ b/usr.bin/make/cond.c       Fri Feb 11 21:18:09 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.329 2022/02/09 21:09:24 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.330 2022/02/11 21:18:09 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.329 2022/02/09 21:09:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.330 2022/02/11 21:18:09 rillig Exp $");
 
 /*
  * Conditional expressions conform to this grammar:
@@ -663,18 +663,11 @@
        }
 
        CondParser_Leaf(par, doEval, true, &rhs, &rhsQuoted);
-       if (rhs.str == NULL)
-               goto done_rhs;
+       t = rhs.str == NULL ? TOK_ERROR
+           : !doEval ? TOK_FALSE
+           : EvalCompare(par, lhs.str, lhsQuoted, op, rhs.str, rhsQuoted);
+       FStr_Done(&rhs);
 
-       if (!doEval) {
-               t = TOK_FALSE;
-               goto done_rhs;
-       }
-
-       t = EvalCompare(par, lhs.str, lhsQuoted, op, rhs.str, rhsQuoted);
-
-done_rhs:
-       FStr_Done(&rhs);
 done_lhs:
        FStr_Done(&lhs);
        return t;



Home | Main Index | Thread Index | Old Index