Permalink
Browse files

* include/ruby/intern.h: Restore rb_enumeratorize as it was before r3…

…7497

  and introduce rb_enumeratorize_with_size instead. [#7302]

* enumerator.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent bc63449 commit a68cc24a9e8ad3c1ce2b9ce4b13d2b5849ec1fd9 @marcandre marcandre committed Nov 7, 2012
Showing with 22 additions and 5 deletions.
  1. +8 −1 ChangeLog
  2. +11 −2 enumerator.c
  3. +3 −2 include/ruby/intern.h
View
@@ -1,3 +1,10 @@
+Thu Nov 8 04:45:21 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * include/ruby/intern.h: Restore rb_enumeratorize as it was before
+ r37497 and introduce rb_enumeratorize_with_size instead. [#7302]
+
+ * enumerator.c: ditto.
+
Wed Nov 7 15:22:37 2012 NARUSE, Yui <naruse@ruby-lang.org>
* numeric.c (ruby_float_step): fix r37514: it yielded with NaN
@@ -16,7 +23,7 @@ Wed Nov 7 12:49:39 2012 Shugo Maeda <shugo@ruby-lang.org>
* eval.c (rb_mod_refine): set RMODULE_IS_REFINEMENT to a created
refinement module, and don't override method_added.
-
+
* vm_method.c (rb_method_entry_make): check redefinition of
optimized methods when a method is added to a refinement module.
[ruby-core:48970] [Bug #7290]
View
@@ -224,7 +224,7 @@ obj_to_enum(int argc, VALUE *argv, VALUE obj)
--argc;
meth = *argv++;
}
- enumerator = rb_enumeratorize(obj, meth, argc, argv, 0);
+ enumerator = rb_enumeratorize_with_size(obj, meth, argc, argv, 0);
if (rb_block_given_p()) {
enumerator_ptr(enumerator)->size = rb_block_proc();
}
@@ -426,8 +426,17 @@ enumerator_init_copy(VALUE obj, VALUE orig)
return obj;
}
+/*
+ * For backwards compatibility; use rb_enumeratorize_with_size
+ */
+VALUE
+rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv)
+{
+ return rb_enumeratorize_with_size(obj, meth, argc, argv, 0);
+}
+
VALUE
-rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv, VALUE (*size_fn)(ANYARGS))
+rb_enumeratorize_with_size(VALUE obj, VALUE meth, int argc, VALUE *argv, VALUE (*size_fn)(ANYARGS))
{
return enumerator_init(enumerator_allocate(rb_cEnumerator), obj, meth, argc, argv, size_fn, Qnil);
}
View
@@ -201,10 +201,11 @@ VALUE rb_fiber_alive_p(VALUE);
/* enum.c */
VALUE rb_enum_values_pack(int, VALUE*);
/* enumerator.c */
-VALUE rb_enumeratorize(VALUE, VALUE, int, VALUE *, VALUE (*)(ANYARGS));
+VALUE rb_enumeratorize(VALUE, VALUE, int, VALUE *);
+VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, VALUE *, VALUE (*)(ANYARGS));
#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) do { \
if (!rb_block_given_p()) \
- return rb_enumeratorize((obj), ID2SYM(rb_frame_this_func()),\
+ return rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()),\
(argc), (argv), (size_fn)); \
} while (0)
#define RETURN_ENUMERATOR(obj, argc, argv) RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)

0 comments on commit a68cc24

Please sign in to comment.