aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/builtin.c b/builtin.c
index 6a2d9d6b..6e7e78bd 100644
--- a/builtin.c
+++ b/builtin.c
@@ -498,6 +498,7 @@ do_length(int nargs)
tmp = POP();
if (tmp->type == Node_var_array) {
static bool warned = false;
+ unsigned long size;
if (do_posix)
fatal(_("length: received array argument"));
@@ -505,7 +506,15 @@ do_length(int nargs)
warned = true;
lintwarn(_("`length(array)' is a gawk extension"));
}
- return make_number((AWKNUM) tmp->table_size);
+
+ /*
+ * Support for deferred loading of array elements requires that
+ * we use the array length interface even though it isn't
+ * necessary for the built-in array types.
+ */
+
+ size = assoc_length(tmp);
+ return make_number(size);
}
assert(tmp->type == Node_val);
@@ -2456,6 +2465,9 @@ do_match(int nargs)
lhs = assoc_lookup(dest, sub);
unref(*lhs);
*lhs = it;
+ /* execute post-assignment routine if any */
+ if (dest->astore != NULL)
+ (*dest->astore)(dest, sub);
unref(sub);
sprintf(buff, "%d", ii);
@@ -2479,6 +2491,8 @@ do_match(int nargs)
lhs = assoc_lookup(dest, sub);
unref(*lhs);
*lhs = it;
+ if (dest->astore != NULL)
+ (*dest->astore)(dest, sub);
unref(sub);
memcpy(buf, buff, ilen);
@@ -2492,6 +2506,8 @@ do_match(int nargs)
lhs = assoc_lookup(dest, sub);
unref(*lhs);
*lhs = it;
+ if (dest->astore != NULL)
+ (*dest->astore)(dest, sub);
unref(sub);
}
}