aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--field.c13
2 files changed, 16 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 223d6fba..e8bd1f53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2017-03-06 Andrew J. Schorr <aschorr@telemetry-investments.com>
+ * field.c (normal_parse_field): Renamed from save_parse_field to reflect
+ better its purpose. Added a comment to explain more clearly what's
+ going on.
+ (set_record, set_parser): Rename save_parse_field to normal_parse_field.
+
+2017-03-06 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
* gawkapi.h (awk_input_buf_t): Remove field_width array and instead
add it as a 6th argument to the get_record function. This should
not break existing code, since it's fine to ignore the additional
diff --git a/field.c b/field.c
index 4a5884a9..276669f8 100644
--- a/field.c
+++ b/field.c
@@ -40,7 +40,12 @@ typedef void (* Setfunc)(long, char *, long, NODE *);
static long (*parse_field)(long, char **, int, NODE *,
Regexp *, Setfunc, NODE *, NODE *, bool);
-static long (*save_parse_field)(long, char **, int, NODE *,
+/*
+ * N.B. The normal_parse_field function pointer contains the parse_field value
+ * that should be used except when API field parsing is overriding the default
+ * field parsing mechanism.
+ */
+static long (*normal_parse_field)(long, char **, int, NODE *,
Regexp *, Setfunc, NODE *, NODE *, bool);
static long re_parse_field(long, char **, int, NODE *,
Regexp *, Setfunc, NODE *, NODE *, bool);
@@ -319,8 +324,8 @@ set_record(const char *buf, int cnt, const int *fw)
}
}
else {
- if (parse_field != save_parse_field) {
- parse_field = save_parse_field;
+ if (parse_field != normal_parse_field) {
+ parse_field = normal_parse_field;
update_PROCINFO_str("FS", current_field_sep_str());
}
}
@@ -1124,7 +1129,7 @@ do_patsplit(int nargs)
static void
set_parser(long (*func)(long, char **, int, NODE *, Regexp *, Setfunc, NODE *, NODE *, bool))
{
- save_parse_field = func;
+ normal_parse_field = func;
if (parse_field != api_parse_field && parse_field != func) {
parse_field = func;
update_PROCINFO_str("FS", current_field_sep_str());