summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-12 02:35:16 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-12 02:35:16 +0000
commitbc241235ac4d02638dfe56d2d87b8cb906400f9d (patch)
tree56a681dff299cf999b45b41890c970d8e96fdda4 /hash.c
parentb9a9a024094026ee5151de237c4d2ae8111ddc03 (diff)
downloadruby-bc241235ac4d02638dfe56d2d87b8cb906400f9d.tar.gz
* 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
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index 95fea9e96d..182a856a38 100644
--- a/hash.c
+++ b/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;