summaryrefslogtreecommitdiff
path: root/array.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 /array.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 'array.c')
-rw-r--r--array.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/array.c b/array.c
index 059574026c..0b825dab5f 100644
--- a/array.c
+++ b/array.c
@@ -1519,7 +1519,7 @@ rb_ary_resurrect(VALUE ary)
extern VALUE rb_output_fs;
-static void ary_join_1(VALUE ary, VALUE sep, long i, VALUE result);
+static void ary_join_1(VALUE obj, VALUE ary, VALUE sep, long i, VALUE result);
static VALUE
recursive_join(VALUE obj, VALUE argp, int recur)
@@ -1533,7 +1533,7 @@ recursive_join(VALUE obj, VALUE argp, int recur)
rb_str_buf_cat_ascii(result, "[...]");
}
else {
- ary_join_1(ary, sep, 0, result);
+ ary_join_1(obj, ary, sep, 0, result);
}
return Qnil;
}
@@ -1555,7 +1555,7 @@ ary_join_0(VALUE ary, VALUE sep, long max, VALUE result)
}
static void
-ary_join_1(VALUE ary, VALUE sep, long i, VALUE result)
+ary_join_1(VALUE obj, VALUE ary, VALUE sep, long i, VALUE result)
{
VALUE val, tmp;
@@ -1581,7 +1581,7 @@ ary_join_1(VALUE ary, VALUE sep, long i, VALUE result)
args[0] = val;
args[1] = sep;
args[2] = result;
- rb_exec_recursive(recursive_join, ary, (VALUE)args);
+ rb_exec_recursive(recursive_join, obj, (VALUE)args);
}
break;
default:
@@ -1592,6 +1592,7 @@ ary_join_1(VALUE ary, VALUE sep, long i, VALUE result)
}
tmp = rb_check_convert_type(val, T_ARRAY, "Array", "to_a");
if (!NIL_P(tmp)) {
+ obj = val;
val = tmp;
goto ary_join;
}
@@ -1626,7 +1627,7 @@ rb_ary_join(VALUE ary, VALUE sep)
if (taint) OBJ_TAINT(result);
if (untrust) OBJ_UNTRUST(result);
ary_join_0(ary, sep, i, result);
- ary_join_1(ary, sep, i, result);
+ ary_join_1(ary, ary, sep, i, result);
return result;
}