* hash.c (rb_hash_aref): skip calling "default" method
if it is not neede for speed-up. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
efddc4b632
commit
261661517a
@ -1,3 +1,8 @@
|
|||||||
|
Sat Oct 16 00:08:00 2010 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* hash.c (rb_hash_aref): skip calling "default" method
|
||||||
|
if it is not neede for speed-up.
|
||||||
|
|
||||||
Fri Oct 15 23:36:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Oct 15 23:36:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* file.c (NUM2DEVT, DEVT2NUM, PRI_DEVT_PREFIX): fallback to
|
* file.c (NUM2DEVT, DEVT2NUM, PRI_DEVT_PREFIX): fallback to
|
||||||
|
9
hash.c
9
hash.c
@ -509,7 +509,14 @@ rb_hash_aref(VALUE hash, VALUE key)
|
|||||||
st_data_t val;
|
st_data_t val;
|
||||||
|
|
||||||
if (!RHASH(hash)->ntbl || !st_lookup(RHASH(hash)->ntbl, key, &val)) {
|
if (!RHASH(hash)->ntbl || !st_lookup(RHASH(hash)->ntbl, key, &val)) {
|
||||||
return rb_funcall(hash, id_default, 1, key);
|
int rb_method_basic_definition_p(VALUE klass, ID id);
|
||||||
|
if (!FL_TEST(hash, HASH_PROC_DEFAULT) &&
|
||||||
|
rb_method_basic_definition_p(CLASS_OF(hash), id_default)) {
|
||||||
|
return RHASH_IFNONE(hash);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return rb_funcall(hash, id_default, 1, key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (VALUE)val;
|
return (VALUE)val;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user