[macruby-changes] [2963] MacRuby/trunk/hash.c
source_changes at macosforge.org
source_changes at macosforge.org
Thu Nov 5 16:55:02 PST 2009
Revision: 2963
http://trac.macosforge.org/projects/ruby/changeset/2963
Author: lsansonetti at apple.com
Date: 2009-11-05 16:54:58 -0800 (Thu, 05 Nov 2009)
Log Message:
-----------
optimized Hash#[] to not dispatch #default if it's unnecessary
Modified Paths:
--------------
MacRuby/trunk/hash.c
Modified: MacRuby/trunk/hash.c
===================================================================
--- MacRuby/trunk/hash.c 2009-11-06 00:33:58 UTC (rev 2962)
+++ MacRuby/trunk/hash.c 2009-11-06 00:54:58 UTC (rev 2963)
@@ -474,8 +474,13 @@
VALUE val;
if (!CFDictionaryGetValueIfPresent((CFDictionaryRef)hash,
- (const void *)RB2OC(key),
- (const void **)&val)) {
+ (const void *)RB2OC(key), (const void **)&val)) {
+ if (*(VALUE *)hash == rb_cCFHash) {
+ struct rb_objc_hash_struct *s = rb_objc_hash_get_struct(hash);
+ if (s == NULL || s->ifnone == Qnil) {
+ return Qnil;
+ }
+ }
return rb_vm_call_with_cache(defaultCache, hash, selDefault, 1, &key);
}
val = OC2RB(val);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091105/a0a4206a/attachment.html>
More information about the macruby-changes
mailing list