From e1ebab4ed015c1c479f98595eecfc8f1bebaba6b Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 20 Aug 2008 21:02:54 +0000 Subject: [PATCH] * range.c (range_initialize_copy): Range is now a Struct. [ruby-core:18353] * struct.c (rb_struct_init_copy): made public. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ range.c | 4 ++++ struct.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6eacc3c3f4..cf36d76bf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Aug 21 06:02:52 2008 Nobuyoshi Nakada + + * 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 * io.c (io_extract_encoding_option): enc2 is external encoding if diff --git a/range.c b/range.c index bbf9830553..09dc762acf 100644 --- a/range.c +++ b/range.c @@ -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); diff --git a/struct.c b/struct.c index 83b0f7b31b..add6bfa03d 100644 --- a/struct.c +++ b/struct.c @@ -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;