aboutsummaryrefslogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
authorshirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-17 02:46:13 +0000
committershirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-17 02:46:13 +0000
commit262cb379d6d2fa6500faa90cfdfa54ae044d2296 (patch)
tree69fa002830f497af50f4e48b9175a31e0d9a4883 /st.c
parent697bdb0d7e0db2148120ebc3776ac7046f27d1ef (diff)
downloadruby-262cb379d6d2fa6500faa90cfdfa54ae044d2296.tar.gz
st_update passes the key in st_table
* st.c (st_update): pass the key in st_table so that we can free memory of the key in st_table when deleting. [ruby-core:49220] [Bug #7330] * test/-ext-/st/test_update.rb (Bug::StTable#test_pass_objects_in_st_table): add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37696 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 91fcb7bc7a..c5550bc673 100644
--- a/st.c
+++ b/st.c
@@ -843,6 +843,7 @@ st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data
if (table->entries_packed) {
st_index_t i = find_packed_index(table, hash_val, key);
if (i < table->real_entries) {
+ key = PKEY(table, i);
value = PVAL(table, i);
existing = 1;
}
@@ -871,6 +872,7 @@ st_update(st_table *table, st_data_t key, st_update_callback_func *func, st_data
FIND_ENTRY(table, ptr, hash_val, bin_pos);
if (ptr != 0) {
+ key = ptr->key;
value = ptr->record;
existing = 1;
}