summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--range.c4
-rw-r--r--struct.c2
3 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 6eacc3c3f..cf36d76bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/range.c b/range.c
index bbf983055..09dc762ac 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 83b0f7b31..add6bfa03 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;