Latest commit to the devel branch changed mapfile to always look up the
array by name for the benefit of callbacks that modify the variable.
Looks like now it does the less efficient lookup on every loop iteration
regardless of the callback having been called (or configured) and also
still does the assignment with the previous method.
I think we can just pick the right method to use each time.
---
builtins/mapfile.def | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/builtins/mapfile.def b/builtins/mapfile.def
index 71fb8196..67feb437 100644
--- a/builtins/mapfile.def
+++ b/builtins/mapfile.def
@@ -197,16 +197,16 @@ mapfile (int fd, long line_count_goal, long origin, long
nskip, long callback_qu
zsyncfd (fd);
run_callback (callback, array_index, line);
- }
-
- /* Bad things can happen if the callback modifies ENTRY, e.g.,
- unsetting it or changing it to a non-indexed-array type, so we
- look it up again every time we need to assign something */
- entry = bind_array_variable (array_name, array_index, line, 0);
- if (entry == 0 || ASSIGN_DISALLOWED (entry, 0))
- return EXECUTION_FAILURE;
- bind_array_element (entry, array_index, line, 0);
+ /* Bad things can happen if the callback modifies ENTRY, e.g.,
+ unsetting it or changing it to a non-indexed-array type, so we
+ look it up again every time we run the callback. */
+ entry = bind_array_variable (array_name, array_index, line, 0);
+ if (entry == 0 || ASSIGN_DISALLOWED (entry, 0))
+ return EXECUTION_FAILURE;
+ }
+ else
+ bind_array_element (entry, array_index, line, 0);
/* Have we exceeded # of lines to store? */
line_count++;
--
2.54.0