From c5d1fd68f7c062a03f44e590699e5ff957fe06be Mon Sep 17 00:00:00 2001 From: knu Date: Tue, 3 Jun 2008 11:06:38 +0000 Subject: * enumerator.c (enumerator_init_copy): Take care of initialize_copy as well as initialize. * test/ruby/test_enumerator.rb: Pull in the test suite for enumerator from trunk. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- enumerator.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'enumerator.c') diff --git a/enumerator.c b/enumerator.c index 8d5061d308..f95d931b62 100644 --- a/enumerator.c +++ b/enumerator.c @@ -293,7 +293,12 @@ enumerator_init_copy(obj, orig) struct enumerator *ptr0, *ptr1; ptr0 = enumerator_ptr(orig); - ptr1 = enumerator_ptr(obj); + + Data_Get_Struct(obj, struct enumerator, ptr1); + + if (!ptr1) { + rb_raise(rb_eArgError, "unallocated enumerator"); + } ptr1->obj = ptr0->obj; ptr1->meth = ptr0->meth; -- cgit v1.2.3