mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* hash.c (rb_hash_reject_bang): do not call rb_hash_foreach() if RHash
has ntbl and it is empty. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b9a9a02409
commit
bc241235ac
2 changed files with 7 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri Jul 12 11:26:25 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* hash.c (rb_hash_reject_bang): do not call rb_hash_foreach() if RHash
|
||||
has ntbl and it is empty.
|
||||
|
||||
Fri Jul 12 11:17:41 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* hash.c (recursive_hash): use RHASH_SIZE() to check hash size.
|
||||
|
|
5
hash.c
5
hash.c
|
@ -1061,9 +1061,8 @@ rb_hash_reject_bang(VALUE hash)
|
|||
|
||||
RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
|
||||
rb_hash_modify(hash);
|
||||
if (!RHASH(hash)->ntbl)
|
||||
return Qnil;
|
||||
n = RHASH(hash)->ntbl->num_entries;
|
||||
n = RHASH_SIZE(hash);
|
||||
if (!n) return Qnil;
|
||||
rb_hash_foreach(hash, delete_if_i, hash);
|
||||
if (n == RHASH(hash)->ntbl->num_entries) return Qnil;
|
||||
return hash;
|
||||
|
|
Loading…
Reference in a new issue