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

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

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
This commit is contained in:
marcandre 2012-11-07 19:46:16 +00:00
parent bc63449331
commit a68cc24a9e
3 changed files with 22 additions and 5 deletions

View file

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

@ -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, VALUE (*size_fn)(ANYARGS))
rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv)
{
return rb_enumeratorize_with_size(obj, meth, argc, argv, 0);
}
VALUE
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 file

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