summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-15 14:19:59 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-15 14:19:59 +0000
commitd95ce7fc033067872c25d294205414cea939b389 (patch)
tree8542bbcc5a5fb5ba9a0db11bd7b75b5afba81548 /error.c
parent73768d54d3af644dab3dc3a5fd12aa75961f3c28 (diff)
* error.c (builtin_type_name): don't return pointer to the buffer of
temporary String object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/error.c b/error.c
index e3348dc7b5..6844f992a6 100644
--- a/error.c
+++ b/error.c
@@ -392,9 +392,11 @@ builtin_type_name(VALUE x)
else if (SYMBOL_P(x)) {
etype = "Symbol";
}
- else if (rb_special_const_p(x)) {
- x = rb_obj_as_string(x);
- etype = StringValuePtr(x);
+ else if (RB_TYPE_P(x, T_TRUE)) {
+ etype = "true";
+ }
+ else if (RB_TYPE_P(x, T_FALSE)) {
+ etype = "false";
}
else {
etype = rb_obj_classname(x);