summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-15 14:20:27 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-15 14:20:27 +0000
commit2baeb78294ecc18f2889eaa3d9a74d6f37ba8791 (patch)
tree6568099b9e7402548a5aa54ea9b5210c80db7854 /enum.c
parentd135138f9b7b64dc49025e27b5a7c9f97b11fa6d (diff)
* enum.c (rb_enum_values_pack): rename from enum_values_pack, and
remove static. * enumerator.c (lazy_init_iterator, lazy_init_yielder, lazy_select_func, lazy_reject_func, lazy_grep_func): handle multiple values correctly. * enumerator.c (lazy_grep): change the behavior when a block is given, to be consistent with Enumerable#grep. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/enum.c b/enum.c
index 2c493e4..bec34e8 100644
--- a/enum.c
+++ b/enum.c
@@ -24,8 +24,8 @@ static ID id_next;
#define id_cmp idCmp
#define id_lshift idLTLT
-static VALUE
-enum_values_pack(int argc, VALUE *argv)
+VALUE
+rb_enum_values_pack(int argc, VALUE *argv)
{
if (argc == 0) return Qnil;
if (argc == 1) return argv[0];
@@ -33,7 +33,7 @@ enum_values_pack(int argc, VALUE *argv)
}
#define ENUM_WANT_SVALUE() do { \
- i = enum_values_pack(argc, argv); \
+ i = rb_enum_values_pack(argc, argv); \
} while (0)
#define enum_yield rb_yield_values2
@@ -386,7 +386,7 @@ static VALUE
collect_all(VALUE i, VALUE ary, int argc, VALUE *argv)
{
rb_thread_check_ints();
- rb_ary_push(ary, enum_values_pack(argc, argv));
+ rb_ary_push(ary, rb_enum_values_pack(argc, argv));
return Qnil;
}
@@ -967,7 +967,7 @@ static VALUE enum_##name##_func(VALUE result, NODE *memo); \
static VALUE \
name##_i(VALUE i, VALUE memo, int argc, VALUE *argv) \
{ \
- return enum_##name##_func(enum_values_pack(argc, argv), RNODE(memo)); \
+ return enum_##name##_func(rb_enum_values_pack(argc, argv), RNODE(memo)); \
} \
\
static VALUE \
@@ -1622,7 +1622,7 @@ member_i(VALUE iter, VALUE args, int argc, VALUE *argv)
{
NODE *memo = RNODE(args);
- if (rb_equal(enum_values_pack(argc, argv), memo->u1.value)) {
+ if (rb_equal(rb_enum_values_pack(argc, argv), memo->u1.value)) {
memo->u2.value = Qtrue;
rb_iter_break();
}
@@ -1656,7 +1656,7 @@ each_with_index_i(VALUE i, VALUE memo, int argc, VALUE *argv)
{
long n = RNODE(memo)->u3.cnt++;
- return rb_yield_values(2, enum_values_pack(argc, argv), INT2NUM(n));
+ return rb_yield_values(2, rb_enum_values_pack(argc, argv), INT2NUM(n));
}
/*
@@ -1920,7 +1920,7 @@ zip_ary(VALUE val, NODE *memo, int argc, VALUE *argv)
int i;
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
- rb_ary_store(tmp, 0, enum_values_pack(argc, argv));
+ rb_ary_store(tmp, 0, rb_enum_values_pack(argc, argv));
for (i=0; i<RARRAY_LEN(args); i++) {
VALUE e = RARRAY_PTR(args)[i];
@@ -1961,7 +1961,7 @@ zip_i(VALUE val, NODE *memo, int argc, VALUE *argv)
int i;
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
- rb_ary_store(tmp, 0, enum_values_pack(argc, argv));
+ rb_ary_store(tmp, 0, rb_enum_values_pack(argc, argv));
for (i=0; i<RARRAY_LEN(args); i++) {
if (NIL_P(RARRAY_PTR(args)[i])) {
rb_ary_push(tmp, Qnil);
@@ -2049,7 +2049,7 @@ static VALUE
take_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
NODE *memo = RNODE(args);
- rb_ary_push(memo->u1.value, enum_values_pack(argc, argv));
+ rb_ary_push(memo->u1.value, rb_enum_values_pack(argc, argv));
if (--memo->u3.cnt == 0) rb_iter_break();
return Qnil;
}
@@ -2088,7 +2088,7 @@ static VALUE
take_while_i(VALUE i, VALUE ary, int argc, VALUE *argv)
{
if (!RTEST(enum_yield(argc, argv))) rb_iter_break();
- rb_ary_push(ary, enum_values_pack(argc, argv));
+ rb_ary_push(ary, rb_enum_values_pack(argc, argv));
return Qnil;
}
@@ -2123,7 +2123,7 @@ drop_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
NODE *memo = RNODE(args);
if (memo->u3.cnt == 0) {
- rb_ary_push(memo->u1.value, enum_values_pack(argc, argv));
+ rb_ary_push(memo->u1.value, rb_enum_values_pack(argc, argv));
}
else {
memo->u3.cnt--;