* marshal.c (class2path): get class path and check referable.
[ruby-dev:22588] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5a8d60bf7f
commit
ea339864af
@ -1,3 +1,8 @@
|
||||
Fri Jan 16 14:33:35 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* marshal.c (class2path): get class path and check referable.
|
||||
[ruby-dev:22588]
|
||||
|
||||
Thu Jan 15 12:58:26 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* io.c (argf_read): do not append EOF. (ruby-bugs-ja:PR#585)
|
||||
|
21
marshal.c
21
marshal.c
@ -98,6 +98,19 @@ struct dump_call_arg {
|
||||
int limit;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
class2path(klass)
|
||||
VALUE klass;
|
||||
{
|
||||
VALUE path = rb_class_path(klass);
|
||||
char *n = RSTRING(path)->ptr;
|
||||
|
||||
if (rb_path2class(n) != klass) {
|
||||
rb_raise(rb_eArgError, "%s cannot be referfed", n);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
static void w_long _((long, struct dump_arg*));
|
||||
|
||||
static void
|
||||
@ -382,7 +395,7 @@ w_class(type, obj, arg, check)
|
||||
VALUE klass = CLASS_OF(obj);
|
||||
w_extended(klass, arg, check);
|
||||
w_byte(type, arg);
|
||||
path = rb_class2name(klass);
|
||||
path = RSTRING(class2path(klass))->ptr;
|
||||
w_unique(path, arg);
|
||||
}
|
||||
|
||||
@ -397,7 +410,7 @@ w_uclass(obj, base_klass, arg)
|
||||
klass = rb_class_real(klass);
|
||||
if (klass != base_klass) {
|
||||
w_byte(TYPE_UCLASS, arg);
|
||||
w_unique(rb_class2name(klass), arg);
|
||||
w_unique(RSTRING(class2path(klass))->ptr, arg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,7 +530,7 @@ w_object(obj, arg, limit)
|
||||
}
|
||||
w_byte(TYPE_CLASS, arg);
|
||||
{
|
||||
VALUE path = rb_class_path(obj);
|
||||
VALUE path = class2path(obj);
|
||||
if (RSTRING(path)->ptr[0] == '#') {
|
||||
rb_raise(rb_eTypeError, "can't dump anonymous class %s",
|
||||
RSTRING(path)->ptr);
|
||||
@ -529,7 +542,7 @@ w_object(obj, arg, limit)
|
||||
case T_MODULE:
|
||||
w_byte(TYPE_MODULE, arg);
|
||||
{
|
||||
VALUE path = rb_class_path(obj);
|
||||
VALUE path = class2path(obj);
|
||||
if (RSTRING(path)->ptr[0] == '#') {
|
||||
rb_raise(rb_eTypeError, "can't dump anonymous module %s",
|
||||
RSTRING(path)->ptr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user