diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-20 16:59:09 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-20 16:59:09 +0000 |
commit | 6228cbe5efb35f3fb867f42525905cf2ded37aad (patch) | |
tree | 887f55ec305ae98927ec8ec4dcbea3245221db6d /hash.c | |
parent | e91e9e7bbf1d93cdff89878b776a7824a9bc2d99 (diff) | |
download | ruby-6228cbe5efb35f3fb867f42525905cf2ded37aad.tar.gz |
dln.c: remove last second typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 18 |
1 files changed, 6 insertions, 12 deletions
@@ -460,12 +460,12 @@ rb_hash_shift(hash) } static enum st_retval -delete_if_i(key, value, keys) - VALUE key, value, keys; +delete_if_i(key, value) + VALUE key, value; { - if (key != Qundef && RTEST(rb_yield_values(2, key, value))) { - rb_ary_push(keys, key); - } + if (key == Qundef) return ST_CONTINUE; + if (RTEST(rb_yield_values(2, key, value))) + return ST_DELETE; return ST_CONTINUE; } @@ -473,14 +473,8 @@ VALUE rb_hash_delete_if(hash) VALUE hash; { - VALUE keys = rb_ary_new(); - long i; - rb_hash_modify(hash); - rb_hash_foreach(hash, delete_if_i, keys); - for (i=0; i<RARRAY(keys)->len; i++) { - st_delete(RHASH(hash)->tbl, &RARRAY(keys)->ptr[i], 0); - } + rb_hash_foreach(hash, delete_if_i, 0); return hash; } |