1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* hash.c (rb_hash_default): should not call default procedure if

no key is given.  [ruby-list:42541]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-07-06 15:44:26 +00:00
parent 6234672a9d
commit b0eab6daaf
2 changed files with 6 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Fri Jul 7 00:38:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* hash.c (rb_hash_default): should not call default procedure if
no key is given. [ruby-list:42541]
Fri Jul 7 00:29:10 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* time.c (time_mload): a patch from Daniel Berger

1
hash.c
View file

@ -508,6 +508,7 @@ rb_hash_default(argc, argv, hash)
rb_scan_args(argc, argv, "01", &key);
if (FL_TEST(hash, HASH_PROC_DEFAULT)) {
if (argc == 0) return Qnil;
return rb_funcall(RHASH(hash)->ifnone, id_call, 2, hash, key);
}
return RHASH(hash)->ifnone;