Skip to content

Commit 50395cb

Browse files
committed
1.9 compatibility for Deque
1 parent b8220f8 commit 50395cb

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

ext/containers/deque/deque.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,9 @@ static VALUE deque_init(int argc, VALUE *argv, VALUE self)
198198
else {
199199
ary = rb_check_array_type(argv[0]);
200200
if(!NIL_P(ary)) {
201-
deque *deque = get_deque_from_self(self);
202-
len = RARRAY(ary)->len;
201+
len = RARRAY_LEN(ary);
203202
for (i = 0; i < len; i++) {
204-
deque_push_back(self, RARRAY(ary)->ptr[i]);
203+
deque_push_back(self, RARRAY_PTR(ary)[i]);
205204
}
206205
}
207206
}

spec/deque_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,5 @@
104104
end
105105
it_should_behave_like "(non-empty deque)"
106106
end
107-
rescue NameError
107+
rescue Exception
108108
end

spec/rb_tree_map_spec.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
describe "non-empty rbtree", :shared => true do
3535
before(:each) do
3636
@num_items = 1000
37-
@random_array = []
38-
@num_items.times { @random_array << rand(@num_items) }
37+
@random_array = Array.new(@num_items) { rand(@num_items) }
3938
@random_array.each { |x| @tree[x] = x }
4039
end
4140

@@ -120,5 +119,5 @@
120119
end
121120
it_should_behave_like "non-empty rbtree"
122121
end
123-
rescue NameError
122+
rescue Exception
124123
end

0 commit comments

Comments
 (0)