diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-23 07:00:50 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-23 07:00:50 +0000 |
commit | 0d8956725284206788bae5fbd6ed032f186ad366 (patch) | |
tree | 766be5e92103ecf3001063b0ff5a703f95bfc3b9 /range.c | |
parent | 2109a52503eb61ef38b25aa2266f0313e7ad56ac (diff) | |
download | ruby-0d8956725284206788bae5fbd6ed032f186ad366.tar.gz |
* struct.c (rb_struct_alloc_noinit): new function.
(rb_struct_define_without_accessor): add allocator to the arguments.
* range.c (range_alloc): re-introduced using rb_struct_alloc_noinit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
-rw-r--r-- | range.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -816,6 +816,14 @@ range_loader(VALUE range, VALUE obj) return range; } +static VALUE +range_alloc(VALUE klass) +{ + /* rb_struct_alloc_noinit itself should not be used because + * rb_marshal_define_compat uses equality of allocaiton function */ + return rb_struct_alloc_noinit(klass); +} + /* A <code>Range</code> represents an interval---a set of values with a * start and an end. Ranges may be constructed using the * <em>s</em><code>..</code><em>e</em> and @@ -879,7 +887,8 @@ Init_Range(void) id_end = rb_intern("end"); id_excl = rb_intern("excl"); - rb_cRange = rb_struct_define_without_accessor("Range", rb_cObject, + rb_cRange = rb_struct_define_without_accessor( + "Range", rb_cObject, range_alloc, "begin", "end", "excl", NULL); rb_include_module(rb_cRange, rb_mEnumerable); |