summaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-18 16:52:19 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-18 16:52:19 +0000
commit3d4a397354fd8d27c5eb91ca5c3bd7afe9b11af0 (patch)
treea3445979718090b4f22a9f4953b5b9ed93d8f131 /st.c
parent6079e6d6fabafea933f01e4a1e26c84f508a3539 (diff)
merge revision(s) 59748: [Backport #14073]
st.c: fix num_entries * st.c (st_insert2): should manage num_entries when the key is undefined, as well as st_insert(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@61328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'st.c')
-rw-r--r--st.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/st.c b/st.c
index c11078a2b8..4bd0d88c15 100644
--- a/st.c
+++ b/st.c
@@ -1182,6 +1182,8 @@ st_insert2(st_table *tab, st_data_t key, st_data_t value,
if (tab->bins == NULL) {
bin = find_entry(tab, hash_value, key);
new_p = bin == UNDEFINED_ENTRY_IND;
+ if (new_p)
+ tab->num_entries++;
bin_ind = UNDEFINED_BIN_IND;
} else {
bin = find_table_bin_ptr_and_reserve(tab, &hash_value,