1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* enumerator.c (enumerator_init_copy): need to copy internal

structure on clone and dup.  [ruby-dev:30192]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-01-25 22:52:38 +00:00
parent df7c570713
commit 369b098721
3 changed files with 24 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Fri Jan 26 07:48:57 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* enumerator.c (enumerator_init_copy): need to copy internal
structure on clone and dup. [ruby-dev:30192]
Wed Jan 24 20:34:51 2007 Kouhei Sutou <kou@cozmixng.org>
* test/ruby/test_iterator.rb: removed a needless workaround.

View file

@ -261,6 +261,21 @@ enumerator_initialize(int argc, VALUE *argv, VALUE obj)
return enumerator_init(obj, recv, meth, argc, argv);
}
/* :nodoc: */
static VALUE
enumerator_init_copy(VALUE obj, VALUE orig)
{
struct enumerator *ptr0 = enumerator_ptr(orig);
struct enumerator *ptr1 = enumerator_ptr(obj);
ptr1->method = ptr0->method;
ptr1->proc = ptr0->proc;
ptr1->iter = ptr0->iter;
ptr1->args = ptr0->args;
return obj;
}
VALUE
rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv)
{
@ -351,6 +366,7 @@ Init_Enumerator(void)
rb_define_alloc_func(rb_cEnumerator, enumerator_allocate);
rb_define_method(rb_cEnumerator, "initialize", enumerator_initialize, -1);
rb_define_method(rb_cEnumerator, "initialize_copy", enumerator_init_copy, 1);
rb_define_method(rb_cEnumerator, "each", enumerator_each, 0);
rb_define_method(rb_cEnumerator, "with_index", enumerator_with_index, 0);
rb_define_method(rb_cEnumerator, "to_splat", enumerator_to_splat, 0);

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-01-23"
#define RUBY_RELEASE_DATE "2007-01-26"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20070123
#define RUBY_RELEASE_CODE 20070126
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 1
#define RUBY_RELEASE_DAY 23
#define RUBY_RELEASE_DAY 26
RUBY_EXTERN const char ruby_version[];
RUBY_EXTERN const char ruby_release_date[];