Skip to content

Commit

Permalink
* marshal.c (must_not_be_anonymous): fixed silly miss.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Aug 9, 2009
1 parent 3ece383 commit a8cf451
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down

0 comments on commit a8cf451

Please sign in to comment.