aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-05 07:52:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-05 07:52:08 +0000
commit6ecc38c4f89f39c07fa97f8b2d39974b76aa1333 (patch)
tree188a491b1b8167917b1e04efc256218bd57b53a2
parent6d9a8a474d4e979d6dc89fb69480905ce3d91021 (diff)
downloadruby-6ecc38c4f89f39c07fa97f8b2d39974b76aa1333.tar.gz
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/trunk@59748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--st.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/st.c b/st.c
index 976bcf4648..a465de4ae5 100644
--- a/st.c
+++ b/st.c
@@ -1197,6 +1197,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 {