summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-10-14 21:57:15 +0300
committerArnold D. Robbins <arnold@skeeve.com>2017-10-14 21:57:15 +0300
commita6ebb5697f02034ca5865940f43e016a730570df (patch)
tree6de8c391e87b81d5b7ffe1cb3a25ec7c8aaa5cc8
parent880974d61412e6d78ee014d7010486fba2e3e1be (diff)
parent8140d635ccee51089aad9a04e9e128e5373377f7 (diff)
downloadgawk-feature/dev-5.0.tar.gz
Merge branch 'master' into feature/dev-5.0feature/dev-5.0
-rw-r--r--ChangeLog5
-rw-r--r--field.c10
2 files changed, 8 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 7906bede..1732f024 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
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>.
+
+ Unrelated:
+
* awkgram.y (check_funcs): Remove the REALLYMEAN ifdef and
simplify the lint checking code for function defined but not
called or called but not defined.
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();