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

* gc.c (gc_mark): enable GC stack checking.

* string.c (str_gsub): lock strings temporarily.  [ruby-dev:24687]

* ext/socket/socket.c (s_recvfrom): tmplock input buffer.
  [ruby-dev:24705]

* array.c (rb_ary_uniq_bang): do not push frozen string from hash
  table.  [ruby-dev:24695]

* array.c (rb_ary_and): ditto.

* array.c (rb_ary_or): ditto.

* ext/enumerator/enumerator.c (each_cons_i): pass copy of an
  internal consequent array.  [ruby-talk:118691]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-11-04 01:20:51 +00:00
parent 5a571ee064
commit d55db6b999
7 changed files with 56 additions and 24 deletions

View file

@ -87,15 +87,13 @@ each_cons_i(val, memo)
{
VALUE ary = memo->u1.value;
long size = memo->u3.cnt;
long len = RARRAY(ary)->len;
if (len == size) {
if (RARRAY(ary)->len == size) {
rb_ary_shift(ary);
rb_ary_push(ary, val);
rb_yield(ary);
} else {
rb_ary_push(ary, val);
if (len + 1 == size) rb_yield(ary);
}
rb_ary_push(ary, val);
if (RARRAY(ary)->len == size) {
rb_yield(rb_ary_dup(ary));
}
return Qnil;
}
@ -106,7 +104,6 @@ enum_each_cons(obj, n)
{
long size = NUM2LONG(n);
NODE *memo;
VALUE ary;
if (size <= 0) rb_raise(rb_eArgError, "invalid size");
memo = rb_node_newnode(NODE_MEMO, rb_ary_new2(size), 0, size);