From f404b21f849af06fb8bbd4b87fdfb585e904d6c3 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sun, 13 Mar 2022 15:42:14 +0900 Subject: merge revision(s) 496591de96b261b8789332c7f8b2bfbd17658955: [Backport #18578] 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] --- st.c | 1 - test/ruby/test_hash.rb | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) --- st.c | 1 - 1 file changed, 1 deletion(-) (limited to 'st.c') diff --git a/st.c b/st.c index dd7870562e..9131dc13c2 100644 --- a/st.c +++ b/st.c @@ -1356,7 +1356,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; } -- cgit v1.2.3