summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-11 09:30:31 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-11 09:30:31 (GMT)
commit56e3b493043f5d1b25a52d073f25b8c0f825052f (patch)
treefa88b2cc3b0305c9a4808925566af5416e610482 /hash.c
parent9cf11364817c58b0a8801e458ee2ee1d0d040789 (diff)
sprintf.c: nil value is valid
* sprintf.c (rb_str_format): look up the key, then get default value and raise KeyError if the returned value is nil. [ruby-dev:49338] [Ruby trunk - Bug #11677] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hash.c b/hash.c
index f34e6e7..a41e8bf 100644
--- a/hash.c
+++ b/hash.c
@@ -758,8 +758,8 @@ rb_hash_rehash(VALUE hash)
return hash;
}
-static VALUE
-hash_default_value(VALUE hash, VALUE key)
+VALUE
+rb_hash_default_value(VALUE hash, VALUE key)
{
if (rb_method_basic_definition_p(CLASS_OF(hash), id_default)) {
VALUE ifnone = RHASH_IFNONE(hash);
@@ -792,7 +792,7 @@ rb_hash_aref(VALUE hash, VALUE key)
st_data_t val;
if (!RHASH(hash)->ntbl || !st_lookup(RHASH(hash)->ntbl, key, &val)) {
- return hash_default_value(hash, key);
+ return rb_hash_default_value(hash, key);
}
return (VALUE)val;
}
@@ -1184,7 +1184,7 @@ rb_hash_shift(VALUE hash)
}
}
}
- return hash_default_value(hash, Qnil);
+ return rb_hash_default_value(hash, Qnil);
}
static int