aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2019-01-06 10:25:11 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2019-01-06 10:25:11 -0500
commitf2fc8da25ca6fe6c089e89d2a612ec3271cf1ed1 (patch)
treea17e1f3a8e2f6fd82f67f0be65f0b676649ac96a
parent0678c088360752f332752c3eaec551280151c29c (diff)
downloadegawk-f2fc8da25ca6fe6c089e89d2a612ec3271cf1ed1.tar.gz
egawk-f2fc8da25ca6fe6c089e89d2a612ec3271cf1ed1.tar.bz2
egawk-f2fc8da25ca6fe6c089e89d2a612ec3271cf1ed1.zip
Reset the implementation of empty arrays.
-rwxr-xr-xChangeLog6
-rw-r--r--array.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index e713dd48..5efa7213 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2019-01-06 Andrew J. Schorr <aschorr@telemetry-investments.com>
+ * array.c (do_delete): If the array is now empty, reset it to the
+ null implementation to avoid being locked into the backend
+ optimization previously selected.
+
+2019-01-06 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
Remove pointless alength macro/method that uses a needless
function call indirection to access the table_size value.
diff --git a/array.c b/array.c
index d8fbab33..a47660c8 100644
--- a/array.c
+++ b/array.c
@@ -608,6 +608,9 @@ do_delete(NODE *symbol, int nsubs)
(void) assoc_remove(symbol, subs);
DEREF(subs);
+ if (assoc_empty(symbol))
+ /* last element was removed, so reset array type to null */
+ null_array(symbol);
#undef free_subs
}