[前][次][番号順一覧][スレッド一覧]

ruby-changes:18486

From: usa <ko1@a...>
Date: Tue, 11 Jan 2011 13:09:13 +0900 (JST)
Subject: [ruby-changes:18486] Ruby:r30509 (trunk): * array.c (rb_ary_resize): should care of embeded array when extending

usa	2011-01-11 13:09:02 +0900 (Tue, 11 Jan 2011)

  New Revision: 30509

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30509

  Log:
    * array.c (rb_ary_resize): should care of embeded array when extending
      the array.
    
    * array.c (rb_ary_resize): need to set capa when changing the real
      size of the array.
      these are latent bugs.

  Modified files:
    trunk/ChangeLog
    trunk/array.c

Index: array.c
===================================================================
--- array.c	(revision 30508)
+++ array.c	(revision 30509)
@@ -1332,7 +1332,7 @@
 	    ary_double_capa(ary, len);
 	}
 	rb_mem_clear(RARRAY_PTR(ary) + olen, len - olen);
-        ARY_SET_HEAP_LEN(ary, len);
+        ARY_SET_LEN(ary, len);
     }
     else if (ARY_EMBED_P(ary)) {
         ARY_SET_EMBED_LEN(ary, len);
@@ -1347,6 +1347,7 @@
     else {
 	if (olen > len + ARY_DEFAULT_SIZE) {
 	    REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, len);
+	    ARY_SET_CAPA(ary, len);
 	}
 	ARY_SET_HEAP_LEN(ary, len);
     }
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30508)
+++ ChangeLog	(revision 30509)
@@ -1,3 +1,12 @@
+Tue Jan 11 13:06:38 2011  NAKAMURA Usaku  <usa@r...>
+
+	* array.c (rb_ary_resize): should care of embeded array when extending
+	  the array.
+
+	* array.c (rb_ary_resize): need to set capa when changing the real
+	  size of the array.
+	  these are latent bugs.
+
 Mon Jan 10 22:46:43 2011  Nobuyoshi Nakada  <nobu@r...>
 
 	* include/ruby/defines.h (CASEFOLD_FILESYSTEM): HFS+ is case

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]