ruby-changes:30011
From: ko1 <ko1@a...>
Date: Fri, 19 Jul 2013 15:21:23 +0900 (JST)
Subject: [ruby-changes:30011] ko1:r42063 (trunk): * array.c (ary_ensure_room_for_push): use RARRAY_RAWPTR() instead of
ko1 2013-07-19 15:21:12 +0900 (Fri, 19 Jul 2013) New Revision: 42063 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42063 Log: * array.c (ary_ensure_room_for_push): use RARRAY_RAWPTR() instead of RARRAY_PTR. In this code, there are no "write" operation. * array.c (rb_ary_equal): ditto. * array.c (recursive_equal): ditto. Modified files: trunk/ChangeLog trunk/array.c Index: array.c =================================================================== --- array.c (revision 42062) +++ array.c (revision 42063) @@ -349,7 +349,7 @@ ary_ensure_room_for_push(VALUE ary, long https://github.com/ruby/ruby/blob/trunk/array.c#L349 if (new_len > RARRAY_EMBED_LEN_MAX) { VALUE shared = ARY_SHARED(ary); if (ARY_SHARED_NUM(shared) == 1) { - if (RARRAY_PTR(ary) - RARRAY_PTR(shared) + new_len <= RARRAY_LEN(shared)) { + if (RARRAY_RAWPTR(ary) - RARRAY_RAWPTR(shared) + new_len <= RARRAY_LEN(shared)) { rb_ary_modify_check(ary); } else { @@ -3584,12 +3584,12 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/array.c#L3584 recursive_equal(VALUE ary1, VALUE ary2, int recur) { long i, len1; - VALUE *p1, *p2; + const VALUE *p1, *p2; if (recur) return Qtrue; /* Subtle! */ - p1 = RARRAY_PTR(ary1); - p2 = RARRAY_PTR(ary2); + p1 = RARRAY_RAWPTR(ary1); + p2 = RARRAY_RAWPTR(ary2); len1 = RARRAY_LEN(ary1); for (i = 0; i < len1; i++) { @@ -3600,8 +3600,8 @@ recursive_equal(VALUE ary1, VALUE ary2, https://github.com/ruby/ruby/blob/trunk/array.c#L3600 return Qfalse; if (len1 < i) return Qtrue; - p1 = RARRAY_PTR(ary1) + i; - p2 = RARRAY_PTR(ary2) + i; + p1 = RARRAY_RAWPTR(ary1) + i; + p2 = RARRAY_RAWPTR(ary2) + i; } else { return Qfalse; @@ -3638,7 +3638,7 @@ rb_ary_equal(VALUE ary1, VALUE ary2) https://github.com/ruby/ruby/blob/trunk/array.c#L3638 return rb_equal(ary2, ary1); } if (RARRAY_LEN(ary1) != RARRAY_LEN(ary2)) return Qfalse; - if (RARRAY_PTR(ary1) == RARRAY_PTR(ary2)) return Qtrue; + if (RARRAY_RAWPTR(ary1) == RARRAY_RAWPTR(ary2)) return Qtrue; return rb_exec_recursive_paired(recursive_equal, ary1, ary2, ary2); } Index: ChangeLog =================================================================== --- ChangeLog (revision 42062) +++ ChangeLog (revision 42063) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jul 19 15:19:37 2013 Koichi Sasada <ko1@a...> + + * array.c (ary_ensure_room_for_push): use RARRAY_RAWPTR() instead of + RARRAY_PTR. In this code, there are no "write" operation. + + * array.c (rb_ary_equal): ditto. + + * array.c (recursive_equal): ditto. + Fri Jul 19 15:09:22 2013 Koichi Sasada <ko1@a...> * gc.c, internal.h (rb_gc_writebarrier_remember_promoted): add a new -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/