ruby-changes:35107
From: ko1 <ko1@a...>
Date: Fri, 15 Aug 2014 19:33:11 +0900 (JST)
Subject: [ruby-changes:35107] ko1:r47189 (trunk): * array.c (rb_ary_tmp_new): added.
ko1 2014-08-15 19:32:58 +0900 (Fri, 15 Aug 2014) New Revision: 47189 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47189 Log: * array.c (rb_ary_tmp_new): added. This function creates internal use only array (which is completely hided by ObjectSpace.each_object) with filling nil. Otherwise, it can be incldues strange VALUEs. * internal.h: added. * node.h: use rb_ary_tmp_new_fill() for MEMO. Modified files: trunk/ChangeLog trunk/array.c trunk/internal.h trunk/node.h Index: array.c =================================================================== --- array.c (revision 47188) +++ array.c (revision 47189) @@ -550,6 +550,15 @@ rb_ary_tmp_new(long capa) https://github.com/ruby/ruby/blob/trunk/array.c#L550 return ary_new(0, capa); } +VALUE +rb_ary_tmp_new_fill(long capa) +{ + VALUE ary = ary_new(0, capa); + ary_memfill(ary, 0, capa, Qnil); + ARY_SET_LEN(ary, capa); + return ary; +} + void rb_ary_free(VALUE ary) { Index: ChangeLog =================================================================== --- ChangeLog (revision 47188) +++ ChangeLog (revision 47189) @@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Aug 15 19:27:25 2014 Koichi Sasada <ko1@a...> + + * array.c (rb_ary_tmp_new): added. + This function creates internal use only array (which is completely + hided by ObjectSpace.each_object) with filling nil. + + Otherwise, it can be incldues strange VALUEs. + + * internal.h: added. + + * node.h: use rb_ary_tmp_new_fill() for MEMO. + Fri Aug 15 10:13:37 2014 SHIBATA Hiroshi <shibata.hiroshi@g...> * lib/gserver.rb: removed unmaintained code. Index: internal.h =================================================================== --- internal.h (revision 47188) +++ internal.h (revision 47189) @@ -506,6 +506,7 @@ struct vtm; /* defined by timev.h */ https://github.com/ruby/ruby/blob/trunk/internal.h#L506 VALUE rb_ary_last(int, const VALUE *, VALUE); void rb_ary_set_len(VALUE, long); void rb_ary_delete_same(VALUE, VALUE); +VALUE rb_ary_tmp_new_fill(long capa); /* bignum.c */ VALUE rb_big_fdiv(VALUE x, VALUE y); Index: node.h =================================================================== --- node.h (revision 47188) +++ node.h (revision 47189) @@ -468,9 +468,7 @@ typedef struct RNode { https://github.com/ruby/ruby/blob/trunk/node.h#L468 #define roomof(x, y) ((sizeof(x) + sizeof(y) - 1) / sizeof(y)) #define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value)) #define NEW_MEMO_FOR(type, value) \ - (rb_ary_set_len(((value) = rb_ary_tmp_new(roomof(type, VALUE))), \ - roomof(type, VALUE)), \ - MEMO_FOR(type, value)) + ((value) = rb_ary_tmp_new_fill(roomof(type, VALUE)), MEMO_FOR(type, value)) RUBY_SYMBOL_EXPORT_BEGIN -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/