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

ruby-changes:30609

From: ko1 <ko1@a...>
Date: Mon, 26 Aug 2013 14:47:34 +0900 (JST)
Subject: [ruby-changes:30609] ko1:r42688 (trunk): * array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB because

ko1	2013-08-26 14:47:27 +0900 (Mon, 26 Aug 2013)

  New Revision: 42688

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

  Log:
    * array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB because
      there are not new relations.
    * enum.c (enum_sort_by): ditto.
    * struct.c (setup_struct): use RARRAY_RAWPTR().
    * vm_eval.c (yield_under): ditto.
    * ext/pathname/pathname.c (path_entries): use RARRAY_AREF().
    * ext/pathname/pathname.c (path_s_glob): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/array.c
    trunk/enum.c
    trunk/ext/pathname/pathname.c
    trunk/struct.c
    trunk/vm_eval.c
Index: array.c
===================================================================
--- array.c	(revision 42687)
+++ array.c	(revision 42688)
@@ -1545,8 +1545,9 @@ rb_ary_splice(VALUE ary, long beg, long https://github.com/ruby/ruby/blob/trunk/array.c#L1545
 	}
 
 	if (len != rlen) {
-	    MEMMOVE(RARRAY_PTR(ary) + beg + rlen, RARRAY_PTR(ary) + beg + len,
-		    VALUE, RARRAY_LEN(ary) - (beg + len));
+	    RARRAY_PTR_USE(ary, ptr, 
+			   MEMMOVE(ptr + beg + rlen, ptr + beg + len,
+				   VALUE, RARRAY_LEN(ary) - (beg + len)));
 	    ARY_SET_LEN(ary, alen);
 	}
 	if (rlen > 0) {
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42687)
+++ ChangeLog	(revision 42688)
@@ -1,3 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Aug 26 14:44:26 2013  Koichi Sasada  <ko1@a...>
+
+	* array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB because
+	  there are not new relations.
+
+	* enum.c (enum_sort_by): ditto.
+
+	* struct.c (setup_struct): use RARRAY_RAWPTR().
+
+	* vm_eval.c (yield_under): ditto.
+
+	* ext/pathname/pathname.c (path_entries): use RARRAY_AREF().
+
+	* ext/pathname/pathname.c (path_s_glob): ditto.
+
 Mon Aug 26 13:11:10 2013  Kazuhiro NISHIYAMA  <zn@m...>
 
 	* array.c (ary_ensure_room_for_push): fix typo in r42658.
Index: enum.c
===================================================================
--- enum.c	(revision 42687)
+++ enum.c	(revision 42688)
@@ -944,8 +944,9 @@ enum_sort_by(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enum.c#L944
 	rb_ary_concat(ary, buf);
     }
     if (RARRAY_LEN(ary) > 2) {
-	ruby_qsort(RARRAY_PTR(ary), RARRAY_LEN(ary)/2, 2*sizeof(VALUE),
-		   sort_by_cmp, (void *)ary);
+	RARRAY_PTR_USE(ary, ptr,
+		      ruby_qsort(ptr, RARRAY_LEN(ary)/2, 2*sizeof(VALUE),
+				 sort_by_cmp, (void *)ary));
     }
     if (RBASIC(ary)->klass) {
 	rb_raise(rb_eRuntimeError, "sort_by reentered");
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 42687)
+++ vm_eval.c	(revision 42688)
@@ -1510,7 +1510,7 @@ yield_under(VALUE under, VALUE self, VAL https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1510
 	return vm_yield_with_cref(th, 1, &self, cref);
     }
     else {
-	return vm_yield_with_cref(th, RARRAY_LENINT(values), RARRAY_PTR(values), cref);
+	return vm_yield_with_cref(th, RARRAY_LENINT(values), RARRAY_RAWPTR(values), cref);
     }
 }
 
Index: struct.c
===================================================================
--- struct.c	(revision 42687)
+++ struct.c	(revision 42688)
@@ -197,7 +197,7 @@ new_struct(VALUE name, VALUE super) https://github.com/ruby/ruby/blob/trunk/struct.c#L197
 static VALUE
 setup_struct(VALUE nstr, VALUE members)
 {
-    VALUE *ptr_members;
+    const VALUE *ptr_members;
     long i, len;
 
     OBJ_FREEZE(members);
@@ -207,7 +207,7 @@ setup_struct(VALUE nstr, VALUE members) https://github.com/ruby/ruby/blob/trunk/struct.c#L207
     rb_define_singleton_method(nstr, "new", rb_class_new_instance, -1);
     rb_define_singleton_method(nstr, "[]", rb_class_new_instance, -1);
     rb_define_singleton_method(nstr, "members", rb_struct_s_members_m, 0);
-    ptr_members = RARRAY_PTR(members);
+    ptr_members = RARRAY_RAWPTR(members);
     len = RARRAY_LEN(members);
     for (i=0; i< len; i++) {
 	ID id = SYM2ID(ptr_members[i]);
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 42687)
+++ ext/pathname/pathname.c	(revision 42688)
@@ -997,7 +997,7 @@ path_s_glob(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L997
         ary = rb_funcall2(rb_cDir, rb_intern("glob"), n, args);
         ary = rb_convert_type(ary, T_ARRAY, "Array", "to_ary");
         for (i = 0; i < RARRAY_LEN(ary); i++) {
-            VALUE elt = RARRAY_PTR(ary)[i];
+            VALUE elt = RARRAY_AREF(ary, i);
             elt = rb_class_new_instance(1, &elt, klass);
             rb_ary_store(ary, i, elt);
         }
@@ -1057,7 +1057,7 @@ path_entries(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L1057
     ary = rb_funcall(rb_cDir, rb_intern("entries"), 1, str);
     ary = rb_convert_type(ary, T_ARRAY, "Array", "to_ary");
     for (i = 0; i < RARRAY_LEN(ary); i++) {
-        VALUE elt = RARRAY_PTR(ary)[i];
+	VALUE elt = RARRAY_AREF(ary, i);
         elt = rb_class_new_instance(1, &elt, klass);
         rb_ary_store(ary, i, elt);
     }

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

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