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

ruby-changes:30014

From: ko1 <ko1@a...>
Date: Fri, 19 Jul 2013 19:16:41 +0900 (JST)
Subject: [ruby-changes:30014] ko1:r42066 (trunk): * array.c (rb_ary_resurrect): use RARRAY_RAWPTR() because there is no

ko1	2013-07-19 19:16:31 +0900 (Fri, 19 Jul 2013)

  New Revision: 42066

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

  Log:
    * array.c (rb_ary_resurrect): use RARRAY_RAWPTR() because there is no
      writing.
    * array.c (rb_ary_new_from_values): use ary_memcpy().

  Modified files:
    trunk/ChangeLog
    trunk/array.c

Index: array.c
===================================================================
--- array.c	(revision 42065)
+++ array.c	(revision 42066)
@@ -11,7 +11,7 @@ https://github.com/ruby/ruby/blob/trunk/array.c#L11
 
 **********************************************************************/
 
-#define RGENGC_UNPROTECT_LOGGING 0
+#define RGENGC_UNPROTECT_LOGGING 1
 #if RGENGC_UNPROTECT_LOGGING
 static void ary_unprotect_logging(void *x, const char *filename, int line);
 #define RGENGC_LOGGING_WB_UNPROTECT(x, f, l) ary_unprotect_logging((void *)x, f, l)
@@ -543,10 +543,7 @@ rb_ary_new_from_values(long n, const VAL https://github.com/ruby/ruby/blob/trunk/array.c#L543
 
     ary = rb_ary_new2(n);
     if (n > 0 && elts) {
-	assert(!OBJ_PROMOTED(ary));
-	RARRAY_PTR_USE(ary, ptr, {
-	    MEMCPY(ptr, elts, VALUE, n); /* new array is not old gen */
-	});
+	ary_memcpy(ary, 0, n, elts);
 	ARY_SET_LEN(ary, n);
     }
 
@@ -1891,7 +1888,7 @@ rb_ary_dup(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L1888
 VALUE
 rb_ary_resurrect(VALUE ary)
 {
-    return rb_ary_new4(RARRAY_LEN(ary), RARRAY_PTR(ary));
+    return rb_ary_new4(RARRAY_LEN(ary), RARRAY_RAWPTR(ary));
 }
 
 extern VALUE rb_output_fs;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42065)
+++ ChangeLog	(revision 42066)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jul 19 19:15:30 2013  Koichi Sasada  <ko1@a...>
+
+	* array.c (rb_ary_resurrect): use RARRAY_RAWPTR() because there is no
+	  writing.
+
+	* array.c (rb_ary_new_from_values): use ary_memcpy().
+
 Fri Jul 19 19:07:31 2013  Koichi Sasada  <ko1@a...>
 
 	* array.c (ary_memcpy): add a function to copy VALUEs into ary

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

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