Skip to content

Commit

Permalink
* hash.c (rb_hash_reject_bang): do not call rb_hash_foreach() if RHash
Browse files Browse the repository at this point in the history
  has ntbl and it is empty.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
glass committed Jul 12, 2013
1 parent b9a9a02 commit bc24123
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Fri Jul 12 11:26:25 2013 Masaki Matsushita <[email protected]>

* 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 <[email protected]>

* hash.c (recursive_hash): use RHASH_SIZE() to check hash size.
Expand Down
5 changes: 2 additions & 3 deletions hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bc24123

Please sign in to comment.