summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-09 22:02:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-09 22:02:31 +0000
commita8cf451714d1794f4bd95c422391ca5574735d41 (patch)
treedc5e5514091173f9f07fcf1e4c6e7d0bac6836f5 /marshal.c
parent3ece38366080f6c862e243d152476572ba15268a (diff)
* marshal.c (must_not_be_anonymous): fixed silly miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/marshal.c b/marshal.c
index 3e6937f1d4..300391191e 100644
--- a/marshal.c
+++ b/marshal.c
@@ -168,7 +168,7 @@ mark_dump_arg(void *ptr)
rb_mark_hash(p->compat_tbl);
}
-static void
+static const char *
must_not_be_anonymous(const char *type, VALUE path)
{
char *n = RSTRING_PTR(path);
@@ -178,17 +178,19 @@ must_not_be_anonymous(const char *type, VALUE path)
rb_raise(rb_eTypeError, "can't dump non-ascii %s name", type);
}
if (n[0] == '#') {
- rb_raise(rb_eTypeError, "can't dump anonymous %s %s", type,
+ rb_raise(rb_eTypeError, "can't dump anonymous %s %.*s", type,
(int)RSTRING_LEN(path), n);
}
+ return n;
}
static VALUE
class2path(VALUE klass)
{
VALUE path = rb_class_path(klass);
+ const char *n;
- must_not_be_anonymous((TYPE(klass) == T_CLASS ? "class" : "module"), path);
+ n = must_not_be_anonymous((TYPE(klass) == T_CLASS ? "class" : "module"), path);
if (rb_path_to_class(path) != rb_class_real(klass)) {
rb_raise(rb_eTypeError, "%s can't be referred to", n);
}