1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2008-08-20 21:02:54 +00:00
parent 6ed5ad856c
commit e1ebab4ed0
3 changed files with 12 additions and 1 deletions

View file

@ -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

View file

@ -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);

View file

@ -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;