From 5826beec258141776469c5fd9b703d52c81a35fb Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Tue, 14 Jun 2016 16:35:48 -0400 Subject: Add a new boolval function to awk.h to make sure we handle this consistently. --- eval.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 90947dc5..ee674911 100644 --- a/eval.c +++ b/eval.c @@ -692,7 +692,6 @@ void set_IGNORECASE() { static bool warned = false; - NODE *n; if ((do_lint || do_traditional) && ! warned) { warned = true; @@ -701,13 +700,8 @@ set_IGNORECASE() load_casetable(); if (do_traditional) IGNORECASE = false; - else { - n = fixtype(IGNORECASE_node->var_value); - if ((n->flags & NUMBER) != 0) - IGNORECASE = ! iszero(n); - else - IGNORECASE = (n->stlen > 0); - } + else + IGNORECASE = boolval(IGNORECASE_node->var_value); set_RS(); /* set_RS() calls set_FS() if need be, for us */ } @@ -1517,12 +1511,7 @@ eval_condition(NODE *t) if (t == node_Boolean[true]) return true; - (void) fixtype(t); - - if ((t->flags & NUMBER) != 0) - return ! iszero(t); - - return (t->stlen != 0); + return boolval(t); } /* cmp_scalars -- compare two nodes on the stack */ -- cgit v1.2.1