Module Name: src
Committed By: rillig
Date: Fri Feb 11 21:18:10 UTC 2022
Modified Files:
src/usr.bin/make: cond.c
Log Message:
make: simplify control flow in CondParser_Comparison
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.329 -r1.330 src/usr.bin/make/cond.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/cond.c
diff -u src/usr.bin/make/cond.c:1.329 src/usr.bin/make/cond.c:1.330
--- src/usr.bin/make/cond.c:1.329 Wed Feb 9 21:09:24 2022
+++ src/usr.bin/make/cond.c Fri Feb 11 21:18:09 2022
@@ -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_Comparison(CondParser *par, b
}
CondParser_Leaf(par, doEval, true, &rhs, &rhsQuoted);
- if (rhs.str == NULL)
- goto done_rhs;
-
- if (!doEval) {
- t = TOK_FALSE;
- goto done_rhs;
- }
-
- t = EvalCompare(par, lhs.str, lhsQuoted, op, rhs.str, rhsQuoted);
-
-done_rhs:
+ t = rhs.str == NULL ? TOK_ERROR
+ : !doEval ? TOK_FALSE
+ : EvalCompare(par, lhs.str, lhsQuoted, op, rhs.str, rhsQuoted);
FStr_Done(&rhs);
+
done_lhs:
FStr_Done(&lhs);
return t;