summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-10 07:30:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-10 07:30:08 +0000
commitaf8f8e5b0e135570f9e5cd2aa8e949ec2e204b31 (patch)
tree627e3a415dba6b7f070bc0c60db0eec60af897ff /enum.c
parent5e2a28d13de0d44852c7b040c17d80387cc0f058 (diff)
* array.c (recursive_join): use obj to tell if recursion occurs.
[ruby-core:24150] * enum.c (enum_join): reverted r23966. [ruby-core:24196] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c31
1 files changed, 1 insertions, 30 deletions
diff --git a/enum.c b/enum.c
index 678ae8afb4..3379cf2c75 100644
--- a/enum.c
+++ b/enum.c
@@ -1802,35 +1802,6 @@ enum_cycle(int argc, VALUE *argv, VALUE obj)
return Qnil; /* not reached */
}
-static VALUE
-join_i(VALUE i, VALUE args, int argc, VALUE *argv)
-{
- VALUE *arg = (VALUE *)args;
- ENUM_WANT_SVALUE();
- if (!arg[0]) {
- arg[0] = rb_usascii_str_new(0, 0);
- }
- else if (!NIL_P(arg[1])) {
- rb_str_buf_append(arg[0], arg[1]);
- }
- return rb_str_buf_append(arg[0], rb_obj_as_string(i));
-}
-
-VALUE
-rb_enum_join(VALUE obj, VALUE sep)
-{
- VALUE args[2];
-
- args[0] = 0;
- args[1] = sep;
- if (!NIL_P(sep)) StringValue(args[1]);
- rb_block_call(obj, id_each, 0, 0, join_i, (VALUE)args);
- if (!args[0]) args[0] = rb_str_new(0, 0);
- OBJ_INFECT(args[0], obj);
-
- return args[0];
-}
-
/*
* call-seq:
* enum.join(sep=$,) -> str
@@ -1847,7 +1818,7 @@ enum_join(int argc, VALUE *argv, VALUE obj)
rb_scan_args(argc, argv, "01", &sep);
if (NIL_P(sep)) sep = rb_output_fs;
- return rb_enum_join(obj, sep);
+ return rb_ary_join(enum_to_a(0, 0, obj), sep);
}
/*