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

* enum.c (enum_cycle): hide temporary array from ObjectSpace.

[ruby-core:12762]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-10-22 15:29:17 +00:00
parent ea0c6d3349
commit 15112cf003
3 changed files with 15 additions and 7 deletions

View file

@ -16,6 +16,11 @@ Sun Oct 21 18:29:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (set_primary_encoding): removed primary_encoding setter. * encoding.c (set_primary_encoding): removed primary_encoding setter.
Sat Oct 20 13:17:01 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* enum.c (enum_cycle): hide temporary array from ObjectSpace.
[ruby-core:12762]
Sat Oct 20 11:49:20 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Oct 20 11:49:20 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (rb_get_path): returns frozen string. * file.c (rb_get_path): returns frozen string.

11
enum.c
View file

@ -1541,17 +1541,20 @@ static VALUE
enum_cycle(VALUE obj) enum_cycle(VALUE obj)
{ {
VALUE ary; VALUE ary;
long i; long i, len;
RETURN_ENUMERATOR(obj, 0, 0); RETURN_ENUMERATOR(obj, 0, 0);
ary = rb_ary_new(); ary = rb_ary_new();
RBASIC(ary)->klass = 0;
rb_block_call(obj, id_each, 0, 0, cycle_i, ary); rb_block_call(obj, id_each, 0, 0, cycle_i, ary);
while (RARRAY_LEN(ary) > 0) { len = RARRAY_LEN(ary);
for (i=0; i<RARRAY_LEN(ary); i++) { if (len == 0) return Qnil;
for (;;) {
for (i=0; i<len; i++) {
rb_yield(RARRAY_PTR(ary)[i]); rb_yield(RARRAY_PTR(ary)[i]);
} }
} }
return Qnil; return Qnil; /* not reached */
} }
/* /*

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0" #define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-10-22" #define RUBY_RELEASE_DATE "2007-10-23"
#define RUBY_VERSION_CODE 190 #define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20071022 #define RUBY_RELEASE_CODE 20071023
#define RUBY_PATCHLEVEL 0 #define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0 #define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 10 #define RUBY_RELEASE_MONTH 10
#define RUBY_RELEASE_DAY 22 #define RUBY_RELEASE_DAY 23
#ifdef RUBY_EXTERN #ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[]; RUBY_EXTERN const char ruby_version[];