From 5d7b5481ca60260ef05ee969c8b142143c4aa8c2 Mon Sep 17 00:00:00 2001 From: charliesome Date: Thu, 25 Apr 2013 05:03:30 +0000 Subject: * benchmark/bm_hash_shift.rb: add benchmark for Hash#shift * hash.c (rb_hash_shift): use st_shift if hash is not being iterated to delete element without iterating the whole hash. * hash.c (shift_i): remove function * include/ruby/st.h (st_shift): add st_shift function * st.c (st_shift): ditto [Bug #8312] [ruby-core:54524] Patch by funny-falcon git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/st.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/ruby/st.h') diff --git a/include/ruby/st.h b/include/ruby/st.h index ef838b7aeb..88135f6a38 100644 --- a/include/ruby/st.h +++ b/include/ruby/st.h @@ -102,6 +102,7 @@ st_table *st_init_strcasetable(void); st_table *st_init_strcasetable_with_size(st_index_t); int st_delete(st_table *, st_data_t *, st_data_t *); /* returns 0:notfound 1:deleted */ int st_delete_safe(st_table *, st_data_t *, st_data_t *, st_data_t); +int st_shift(st_table *, st_data_t *, st_data_t *); /* returns 0:notfound 1:deleted */ int st_insert(st_table *, st_data_t, st_data_t); int st_insert2(st_table *, st_data_t, st_data_t, st_data_t (*)(st_data_t)); int st_lookup(st_table *, st_data_t, st_data_t *); -- cgit v1.2.3