summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-23 07:00:50 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-23 07:00:50 +0000
commit0d8956725284206788bae5fbd6ed032f186ad366 (patch)
tree766be5e92103ecf3001063b0ff5a703f95bfc3b9 /range.c
parent2109a52503eb61ef38b25aa2266f0313e7ad56ac (diff)
* 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.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/range.c b/range.c
index 5855be5f91..6bc8dcda4a 100644
--- a/range.c
+++ b/range.c
@@ -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);