aboutsummaryrefslogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2022-02-09 18:24:17 +0900
committerYusuke Endoh <mame@ruby-lang.org>2022-02-10 00:14:27 +0900
commit496591de96b261b8789332c7f8b2bfbd17658955 (patch)
tree4bfeafcfd1086faa26c1cb2893790cebec404328 /st.c
parent8013250136b61e0ae5a8d27a4ec73936cd7647eb (diff)
downloadruby-496591de96b261b8789332c7f8b2bfbd17658955.tar.gz
st.c: Do not clear entries_bound when calling Hash#shift for empty hash
tab->entries_bound is used to check if the bins are full in rebuild_table_if_necessary. Hash#shift against an empty hash assigned 0 to tab->entries_bound, but didn't clear the bins. Thus, the table is not rebuilt even when the bins are full. Attempting to add a new element into full-bin hash gets stuck. This change stops clearing tab->entries_bound in Hash#shift. [Bug #18578]
Diffstat (limited to 'st.c')
-rw-r--r--st.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/st.c b/st.c
index 53e9dc8320..07a083abb0 100644
--- a/st.c
+++ b/st.c
@@ -1363,7 +1363,6 @@ st_shift(st_table *tab, st_data_t *key, st_data_t *value)
return 1;
}
}
- tab->entries_start = tab->entries_bound = 0;
if (value != 0) *value = 0;
return 0;
}