ruby-changes:47632
From: nobu <ko1@a...>
Date: Tue, 5 Sep 2017 16:52:13 +0900 (JST)
Subject: [ruby-changes:47632] nobu:r59748 (trunk): st.c: fix num_entries
nobu 2017-09-05 16:52:08 +0900 (Tue, 05 Sep 2017) New Revision: 59748 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59748 Log: st.c: fix num_entries * st.c (st_insert2): should manage num_entries when the key is undefined, as well as st_insert(). Modified files: trunk/st.c Index: st.c =================================================================== --- st.c (revision 59747) +++ st.c (revision 59748) @@ -1197,6 +1197,8 @@ st_insert2(st_table *tab, st_data_t key, https://github.com/ruby/ruby/blob/trunk/st.c#L1197 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 { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/