summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-14 16:35:48 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-14 16:35:48 -0400
commit5826beec258141776469c5fd9b703d52c81a35fb (patch)
tree2d09f31301c392fa15218d5f133a19f4cfdb5fdb /eval.c
parent56b1798777fe5464014fca3f9744ebdb950b8348 (diff)
downloadgawk-5826beec258141776469c5fd9b703d52c81a35fb.tar.gz
Add a new boolval function to awk.h to make sure we handle this consistently.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c17
1 files changed, 3 insertions, 14 deletions
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 */