summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-20 10:14:18 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-20 10:14:18 +0000
commita40ca8c047d8c174d1757dcbc82ec16185144717 (patch)
treead7d21dc7aeb7c725ce5de1cea332f172803483e
parent6033673c795d398ad84aa17f6eb29dac1d2a9831 (diff)
* reverts r21693.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--array.c4
-rw-r--r--enum.c8
-rw-r--r--test/ruby/test_array.rb5
-rw-r--r--test/ruby/test_enum.rb5
5 files changed, 7 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index d7692f62a8..4b208e534b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Jan 20 19:12:18 2009 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * reverts r21693.
+
Tue Jan 20 18:49:59 2009 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* lib/rdoc/ri/path.rb: Gem::Enable was removed.
diff --git a/array.c b/array.c
index d88a9fcc3f..3ba450cbe9 100644
--- a/array.c
+++ b/array.c
@@ -2209,11 +2209,9 @@ take_i(VALUE val, VALUE *args, int argc, VALUE *argv)
static VALUE
take_items(VALUE obj, long n)
{
- VALUE result = to_ary(obj);
+ VALUE result = rb_ary_new2(n);
VALUE args[2];
- if (!NIL_P(result)) return rb_ary_subseq(result, 0, n);
- result = rb_ary_new2(n);
args[0] = result; args[1] = (VALUE)n;
rb_block_call(obj, rb_intern("each"), 0, 0, take_i, (VALUE)args);
return result;
diff --git a/enum.c b/enum.c
index 8c4b5b93e0..0bb8b6453c 100644
--- a/enum.c
+++ b/enum.c
@@ -1558,17 +1558,13 @@ enum_zip(int argc, VALUE *argv, VALUE obj)
ID conv;
NODE *memo;
VALUE result = Qnil;
- VALUE args = rb_ary_new4(argc, argv);
int allary = Qtrue;
- argv = RARRAY_PTR(args);
for (i=0; i<argc; i++) {
- VALUE ary = rb_check_array_type(argv[i]);
- if (NIL_P(ary)) {
+ if (TYPE(argv[i]) != T_ARRAY) {
allary = Qfalse;
break;
}
- argv[i] = ary;
}
if (!allary) {
CONST_ID(conv, "to_enum");
@@ -1580,7 +1576,7 @@ enum_zip(int argc, VALUE *argv, VALUE obj)
result = rb_ary_new();
}
/* use NODE_DOT2 as memo(v, v, -) */
- memo = rb_node_newnode(NODE_DOT2, result, args, 0);
+ memo = rb_node_newnode(NODE_DOT2, result, rb_ary_new4(argc, argv), 0);
rb_block_call(obj, id_each, 0, 0, allary ? zip_ary : zip_i, (VALUE)memo);
return result;
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 04ed13892b..9edd31dfa7 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1502,11 +1502,6 @@ class TestArray < Test::Unit::TestCase
a = []
[1, 2, 3].zip([:a, :b], ["a", "b", "c", "d"]) {|x| a << x }
assert_equal([[1, :a, "a"], [2, :b, "b"], [3, nil, "c"]], a)
-
- ary = Object.new
- def ary.to_a; [1, 2]; end
- def ary.to_ary; [3, 4]; end
- assert_equal([[5, 3], [6, 4]], [5, 6].zip(ary))
end
def test_transpose
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index 973b7cb420..ed82d7787f 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -211,11 +211,6 @@ class TestEnumerable < Test::Unit::TestCase
a = []
@obj.zip([:a, :b, :c]) {|x,y| a << [x, y] }
assert_equal([[1,:a],[2,:b],[3,:c],[1,nil],[2,nil]], a)
-
- ary = Object.new
- def ary.to_a; [1, 2]; end
- def ary.to_ary; [3, 4]; end
- assert_equal([[1, 3], [2, 4], [3, nil], [1, nil], [2, nil]], @obj.zip(ary))
end
def test_take