summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-07-19 05:47:51 +0300
committerArnold D. Robbins <arnold@skeeve.com>2016-07-19 05:47:51 +0300
commit2a92e9d3cb8ba907376837dadd03abc6ad09b741 (patch)
tree210ec21c62c1e1c085465bebafe6b353c3f2a186 /eval.c
parent95b9f0c6c59cb4de1d7a65c3afe4d618a252de5a (diff)
downloadgawk-2a92e9d3cb8ba907376837dadd03abc6ad09b741.tar.gz
Simplify set_LINT function.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/eval.c b/eval.c
index b857ea4f..48049ae3 100644
--- a/eval.c
+++ b/eval.c
@@ -949,6 +949,10 @@ set_LINT()
int old_lint = do_lint;
NODE *n = LINT_node->var_value;
+ /* start with clean defaults */
+ lintfunc = r_warning;
+ do_flags &= ~(DO_LINT_ALL|DO_LINT_INVALID);
+
if ((n->flags & (STRING|STRCUR)) != 0) {
if ((n->flags & MAYBE_NUM) == 0) {
const char *lintval;
@@ -958,39 +962,24 @@ set_LINT()
lintval = n->stptr;
lintlen = n->stlen;
if (lintlen > 0) {
- do_flags |= DO_LINT_ALL;
- if (lintlen == 5 && strncmp(lintval, "fatal", 5) == 0)
- lintfunc = r_fatal;
- else if (lintlen == 7 && strncmp(lintval, "invalid", 7) == 0) {
- do_flags &= ~ DO_LINT_ALL;
+ if (lintlen == 7 && strncmp(lintval, "invalid", 7) == 0)
do_flags |= DO_LINT_INVALID;
- lintfunc = warning;
- } else
- lintfunc = warning;
- } else {
- do_flags &= ~(DO_LINT_ALL|DO_LINT_INVALID);
- lintfunc = warning;
+ else {
+ do_flags |= DO_LINT_ALL;
+ if (lintlen == 5 && strncmp(lintval, "fatal", 5) == 0)
+ lintfunc = r_fatal;
+ }
}
} else {
(void) force_number(n);
if (! iszero(n))
do_flags |= DO_LINT_ALL;
- else
- do_flags &= ~(DO_LINT_ALL|DO_LINT_INVALID);
- lintfunc = warning;
}
} else if ((n->flags & (NUMCUR|NUMBER)) != 0) {
(void) force_number(n);
if (! iszero(n))
do_flags |= DO_LINT_ALL;
- else
- do_flags &= ~(DO_LINT_ALL|DO_LINT_INVALID);
- lintfunc = warning;
- } else
- do_flags &= ~(DO_LINT_ALL|DO_LINT_INVALID); /* shouldn't happen */
-
- if (! do_lint)
- lintfunc = warning;
+ }
/* explicitly use warning() here, in case lintfunc == r_fatal */
if (old_lint != do_lint && old_lint && ! do_lint)