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

ruby-changes:29201

From: nobu <ko1@a...>
Date: Wed, 12 Jun 2013 16:41:51 +0900 (JST)
Subject: [ruby-changes:29201] nobu:r41253 (trunk): array.c: fix false assertions

nobu	2013-06-12 16:41:40 +0900 (Wed, 12 Jun 2013)

  New Revision: 41253

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

  Log:
    array.c: fix false assertions
    
    * array.c (rb_ary_sort_bang): remove duplicated assertions.
      ARY_HEAP_PTR() implies ary not to be embedded.  [ruby-dev:47419]
      [Bug #8518]

  Modified files:
    trunk/ChangeLog
    trunk/array.c

Index: array.c
===================================================================
--- array.c	(revision 41252)
+++ array.c	(revision 41253)
@@ -2323,7 +2323,6 @@ rb_ary_sort_bang(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L2323
 
 	rb_ary_modify(ary);
         if (ARY_EMBED_P(tmp)) {
-            assert(ARY_EMBED_P(tmp));
             if (ARY_SHARED_P(ary)) { /* ary might be destructively operated in the given block */
                 rb_ary_unshare(ary);
             }
@@ -2332,9 +2331,7 @@ rb_ary_sort_bang(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L2331
             ARY_SET_LEN(ary, ARY_EMBED_LEN(tmp));
         }
         else {
-            assert(!ARY_EMBED_P(tmp));
-            if (ARY_HEAP_PTR(ary) == ARY_HEAP_PTR(tmp)) {
-                assert(!ARY_EMBED_P(ary));
+            if (!ARY_EMBED_P(ary) && ARY_HEAP_PTR(ary) == ARY_HEAP_PTR(tmp)) {
                 FL_UNSET_SHARED(ary);
                 ARY_SET_CAPA(ary, RARRAY_LEN(tmp));
             }
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41252)
+++ ChangeLog	(revision 41253)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jun 12 16:41:38 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* array.c (rb_ary_sort_bang): remove duplicated assertions.
+	  ARY_HEAP_PTR() implies ary not to be embedded.  [ruby-dev:47419]
+	  [Bug #8518]
+
 Wed Jun 12 12:44:45 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* io.c (io_getc): fix 7bit coderange condition, check if ascii read

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

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