diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-26 08:02:39 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-26 08:02:39 +0000 |
commit | c4b61464a69c3b3fb6f9701a3c5b8e0aededb336 (patch) | |
tree | 68400160198fb1340203f152740116f4ef6f17e4 /include | |
parent | 8149f70e13fb2f2577bb9d0666f9f86a13777041 (diff) |
[Backport #8328] [ruby-core:55250] Patch by funny-falcon
* 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
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@41652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/st.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/ruby/st.h b/include/ruby/st.h index 50f2a75328..68cc511809 100644 --- a/include/ruby/st.h +++ b/include/ruby/st.h @@ -109,6 +109,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 *); |