diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | range.c | 4 | ||||
-rw-r--r-- | struct.c | 2 |
3 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,10 @@ +Thu Aug 21 06:02:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * range.c (range_initialize_copy): Range is now a Struct. + [ruby-core:18353] + + * struct.c (rb_struct_init_copy): made public. + Thu Aug 21 03:09:34 2008 Tanaka Akira <akr@fsij.org> * io.c (io_extract_encoding_option): enc2 is external encoding if @@ -15,6 +15,8 @@ VALUE rb_cRange; static ID id_cmp, id_succ, id_beg, id_end, id_excl; +extern VALUE rb_struct_init_copy(VALUE copy, VALUE s); + #define RANGE_BEG(r) (RSTRUCT(r)->as.ary[0]) #define RANGE_END(r) (RSTRUCT(r)->as.ary[1]) #define RANGE_EXCL(r) (RSTRUCT(r)->as.ary[2]) @@ -88,6 +90,7 @@ range_initialize(int argc, VALUE *argv, VALUE range) return Qnil; } +#define range_initialize_copy rb_struct_init_copy /* :nodoc: */ /* * call-seq: @@ -912,6 +915,7 @@ Init_Range(void) rb_include_module(rb_cRange, rb_mEnumerable); rb_marshal_define_compat(rb_cRange, rb_cObject, range_dumper, range_loader); rb_define_method(rb_cRange, "initialize", range_initialize, -1); + rb_define_method(rb_cRange, "initialize_copy", range_initialize_copy, 1); rb_define_method(rb_cRange, "==", range_eq, 1); rb_define_method(rb_cRange, "===", range_eqq, 1); rb_define_method(rb_cRange, "eql?", range_eql, 1); @@ -555,7 +555,7 @@ rb_struct_to_a(VALUE s) } /* :nodoc: */ -static VALUE +VALUE rb_struct_init_copy(VALUE copy, VALUE s) { if (copy == s) return copy; |