aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--field.c10
2 files changed, 8 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c322124..8d5bd15d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-14 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (do_split): Simplify the lint warnings.
+ Based on suggested code by Eric Pruitt <eric.pruitt@gmail.com>.
+
2017-10-08 Arnold D. Robbins <arnold@skeeve.com>
* command.y: Fix the FSF's address.
diff --git a/field.c b/field.c
index 0685e9b5..5ab718d4 100644
--- a/field.c
+++ b/field.c
@@ -946,7 +946,7 @@ do_split(int nargs)
Regexp *rp = NULL;
if (nargs == 4) {
- static bool warned1 = false, warned2 = false;
+ static bool warned = false;
if (do_traditional || do_posix) {
fatal(_("split: fourth argument is a gawk extension"));
@@ -954,14 +954,10 @@ do_split(int nargs)
sep_arr = POP_PARAM();
if (sep_arr->type != Node_var_array)
fatal(_("split: fourth argument is not an array"));
- if (do_lint && ! warned1) {
- warned1 = true;
+ if ((do_lint || do_lint_old) && ! warned) {
+ warned = true;
lintwarn(_("split: fourth argument is a gawk extension"));
}
- if (do_lint_old && ! warned2) {
- warned2 = true;
- warning(_("split: fourth argument is a gawk extension"));
- }
}
sep = POP();