* marshal.c: calls directly rb_{Complex,Rational}_marshal_load().
But now disabled. [experimental] * complex.c: followed the above. * rational.c: ditto. * include/rub/intern.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9977e1cbc7
commit
f5b06413ca
@ -1,3 +1,11 @@
|
|||||||
|
Sun Jun 3 21:14:26 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* marshal.c: calls directly rb_{Complex,Rational}_marshal_load().
|
||||||
|
But now disabled. [experimental]
|
||||||
|
* complex.c: followed the above.
|
||||||
|
* rational.c: ditto.
|
||||||
|
* include/rub/intern.h: ditto.
|
||||||
|
|
||||||
Sun Jun 3 21:18:17 2012 Tanaka Akira <akr@fsij.org>
|
Sun Jun 3 21:18:17 2012 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* process.c (rb_check_argv): use rb_str_new_frozen instead of
|
* process.c (rb_check_argv): use rb_str_new_frozen instead of
|
||||||
|
20
complex.c
20
complex.c
@ -1283,6 +1283,21 @@ nucomp_marshal_load(VALUE self, VALUE a)
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MARSHAL_LOAD_DIRECT
|
||||||
|
/* :nodoc: */
|
||||||
|
static VALUE
|
||||||
|
nucomp_marshal_load_fake(VALUE self, VALUE a)
|
||||||
|
{
|
||||||
|
rb_raise(rb_eNotImpError, "not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_Complex_marshal_load(VALUE obj, VALUE a)
|
||||||
|
{
|
||||||
|
return nucomp_marshal_load(obj, a);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MARSHAL_OLD_STYLE
|
#ifdef MARSHAL_OLD_STYLE
|
||||||
/* :nodoc: */
|
/* :nodoc: */
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -1970,6 +1985,7 @@ Init_Complex(void)
|
|||||||
rb_define_method(rb_cComplex, "to_s", nucomp_to_s, 0);
|
rb_define_method(rb_cComplex, "to_s", nucomp_to_s, 0);
|
||||||
rb_define_method(rb_cComplex, "inspect", nucomp_inspect, 0);
|
rb_define_method(rb_cComplex, "inspect", nucomp_inspect, 0);
|
||||||
|
|
||||||
|
#ifndef MARSHAL_LOAD_DIRECT
|
||||||
#ifndef MARSHAL_OLD_STYLE
|
#ifndef MARSHAL_OLD_STYLE
|
||||||
rb_define_method(rb_cComplex, "marshal_dump", nucomp_marshal_dump, 0);
|
rb_define_method(rb_cComplex, "marshal_dump", nucomp_marshal_dump, 0);
|
||||||
rb_define_method(rb_cComplex, "marshal_load", nucomp_marshal_load, 1);
|
rb_define_method(rb_cComplex, "marshal_load", nucomp_marshal_load, 1);
|
||||||
@ -1977,6 +1993,10 @@ Init_Complex(void)
|
|||||||
rb_define_method(rb_cComplex, "_dump", nucomp_marshal__dump, 1);
|
rb_define_method(rb_cComplex, "_dump", nucomp_marshal__dump, 1);
|
||||||
rb_define_singleton_method(rb_cComplex, "_load", nucomp_marshal__load, 1);
|
rb_define_singleton_method(rb_cComplex, "_load", nucomp_marshal__load, 1);
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
rb_define_method(rb_cComplex, "marshal_dump", nucomp_marshal_dump, 0);
|
||||||
|
rb_define_method(rb_cComplex, "marshal_load", nucomp_marshal_load_fake, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* --- */
|
/* --- */
|
||||||
|
|
||||||
|
@ -147,6 +147,9 @@ VALUE rb_rational_new(VALUE, VALUE);
|
|||||||
VALUE rb_Rational(VALUE, VALUE);
|
VALUE rb_Rational(VALUE, VALUE);
|
||||||
#define rb_Rational1(x) rb_Rational((x), INT2FIX(1))
|
#define rb_Rational1(x) rb_Rational((x), INT2FIX(1))
|
||||||
#define rb_Rational2(x,y) rb_Rational((x), (y))
|
#define rb_Rational2(x,y) rb_Rational((x), (y))
|
||||||
|
#ifdef MARSHAL_LOAD_DIRECT
|
||||||
|
VALUE rb_Rational_marshal_load(VALUE, VALUE);
|
||||||
|
#endif
|
||||||
/* complex.c */
|
/* complex.c */
|
||||||
VALUE rb_complex_raw(VALUE, VALUE);
|
VALUE rb_complex_raw(VALUE, VALUE);
|
||||||
#define rb_complex_raw1(x) rb_complex_raw((x), INT2FIX(0))
|
#define rb_complex_raw1(x) rb_complex_raw((x), INT2FIX(0))
|
||||||
@ -158,6 +161,9 @@ VALUE rb_complex_polar(VALUE, VALUE);
|
|||||||
VALUE rb_Complex(VALUE, VALUE);
|
VALUE rb_Complex(VALUE, VALUE);
|
||||||
#define rb_Complex1(x) rb_Complex((x), INT2FIX(0))
|
#define rb_Complex1(x) rb_Complex((x), INT2FIX(0))
|
||||||
#define rb_Complex2(x,y) rb_Complex((x), (y))
|
#define rb_Complex2(x,y) rb_Complex((x), (y))
|
||||||
|
#ifdef MARSHAL_LOAD_DIRECT
|
||||||
|
VALUE rb_Complex_marshal_load(VALUE, VALUE);
|
||||||
|
#endif
|
||||||
/* class.c */
|
/* class.c */
|
||||||
VALUE rb_class_boot(VALUE);
|
VALUE rb_class_boot(VALUE);
|
||||||
VALUE rb_class_new(VALUE);
|
VALUE rb_class_new(VALUE);
|
||||||
|
14
marshal.c
14
marshal.c
@ -1622,7 +1622,21 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
|
|||||||
}
|
}
|
||||||
v = r_entry(v, arg);
|
v = r_entry(v, arg);
|
||||||
data = r_object(arg);
|
data = r_object(arg);
|
||||||
|
#ifndef MARSHAL_LOAD_DIRECT
|
||||||
rb_funcall(v, s_mload, 1, data);
|
rb_funcall(v, s_mload, 1, data);
|
||||||
|
#else
|
||||||
|
switch (TYPE(v)) {
|
||||||
|
case T_COMPLEX:
|
||||||
|
rb_Complex_marshal_load(v, data);
|
||||||
|
break;
|
||||||
|
case T_RATIONAL:
|
||||||
|
rb_Rational_marshal_load(v, data);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rb_funcall(v, s_mload, 1, data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
check_load_arg(arg, s_mload);
|
check_load_arg(arg, s_mload);
|
||||||
v = r_leave(v, arg);
|
v = r_leave(v, arg);
|
||||||
}
|
}
|
||||||
|
20
rational.c
20
rational.c
@ -1632,6 +1632,21 @@ nurat_marshal_load(VALUE self, VALUE a)
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MARSHAL_LOAD_DIRECT
|
||||||
|
/* :nodoc: */
|
||||||
|
static VALUE
|
||||||
|
nurat_marshal_load_fake(VALUE self, VALUE a)
|
||||||
|
{
|
||||||
|
rb_raise(rb_eNotImpError, "not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_Rational_marshal_load(VALUE obj, VALUE a)
|
||||||
|
{
|
||||||
|
return nurat_marshal_load(obj, a);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MARSHAL_OLD_STYLE
|
#ifdef MARSHAL_OLD_STYLE
|
||||||
/* :nodoc: */
|
/* :nodoc: */
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -2393,6 +2408,7 @@ Init_Rational(void)
|
|||||||
rb_define_method(rb_cRational, "to_s", nurat_to_s, 0);
|
rb_define_method(rb_cRational, "to_s", nurat_to_s, 0);
|
||||||
rb_define_method(rb_cRational, "inspect", nurat_inspect, 0);
|
rb_define_method(rb_cRational, "inspect", nurat_inspect, 0);
|
||||||
|
|
||||||
|
#ifndef MARSHAL_LOAD_DIRECT
|
||||||
#ifndef MARSHAL_OLD_STYLE
|
#ifndef MARSHAL_OLD_STYLE
|
||||||
rb_define_method(rb_cRational, "marshal_dump", nurat_marshal_dump, 0);
|
rb_define_method(rb_cRational, "marshal_dump", nurat_marshal_dump, 0);
|
||||||
rb_define_method(rb_cRational, "marshal_load", nurat_marshal_load, 1);
|
rb_define_method(rb_cRational, "marshal_load", nurat_marshal_load, 1);
|
||||||
@ -2400,6 +2416,10 @@ Init_Rational(void)
|
|||||||
rb_define_method(rb_cRational, "_dump", nurat_marshal__dump, 1);
|
rb_define_method(rb_cRational, "_dump", nurat_marshal__dump, 1);
|
||||||
rb_define_singleton_method(rb_cRational, "_load", nurat_marshal__load, 1);
|
rb_define_singleton_method(rb_cRational, "_load", nurat_marshal__load, 1);
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
rb_define_method(rb_cRational, "marshal_dump", nurat_marshal_dump, 0);
|
||||||
|
rb_define_method(rb_cRational, "marshal_load", nurat_marshal_load_fake, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* --- */
|
/* --- */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user