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

ruby-changes:40375

From: nobu <ko1@a...>
Date: Thu, 5 Nov 2015 10:17:25 +0900 (JST)
Subject: [ruby-changes:40375] nobu:r52456 (trunk): ext: use RARRAY_ASET

nobu	2015-11-05 10:17:19 +0900 (Thu, 05 Nov 2015)

  New Revision: 52456

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

  Log:
    ext: use RARRAY_ASET
    
    * ext/socket/socket.c (make_addrinfo): use RARRAY_ASET for
      write-barrier.
    * ext/tk/tcltklib.c ({call,eval,invoke}_queue_handler): ditto.
    * ext/tk/tkutil/tkutil.c (ary2list, ary2list2): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/socket.c
    trunk/ext/tk/tcltklib.c
    trunk/ext/tk/tkutil/tkutil.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52455)
+++ ChangeLog	(revision 52456)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Nov  5 10:17:17 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/socket/socket.c (make_addrinfo): use RARRAY_ASET for
+	  write-barrier.
+
+	* ext/tk/tcltklib.c ({call,eval,invoke}_queue_handler): ditto.
+
+	* ext/tk/tkutil/tkutil.c (ary2list, ary2list2): ditto.
+
 Thu Nov  5 10:09:12 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/**/*.c: prefer RARRAY_AREF to indexing RARRAY_CONST_PTR.
Index: ext/tk/tcltklib.c
===================================================================
--- ext/tk/tcltklib.c	(revision 52455)
+++ ext/tk/tcltklib.c	(revision 52456)
@@ -7033,7 +7033,7 @@ call_queue_handler(evPtr, flags) https://github.com/ruby/ruby/blob/trunk/ext/tk/tcltklib.c#L7033
     }
 
     /* set result */
-    RARRAY_PTR(q->result)[0] = ret;
+    RARRAY_ASET(q->result, 0, ret);
     ret = (VALUE)NULL;
 
     /* decr internal handler mark */
@@ -7525,7 +7525,7 @@ eval_queue_handler(evPtr, flags) https://github.com/ruby/ruby/blob/trunk/ext/tk/tcltklib.c#L7525
     }
 
     /* set result */
-    RARRAY_PTR(q->result)[0] = ret;
+    RARRAY_ASET(q->result, 0, ret);
     ret = (VALUE)NULL;
 
     /* decr internal handler mark */
@@ -9026,7 +9026,7 @@ invoke_queue_handler(evPtr, flags) https://github.com/ruby/ruby/blob/trunk/ext/tk/tcltklib.c#L9026
     }
 
     /* set result */
-    RARRAY_PTR(q->result)[0] = ret;
+    RARRAY_ASET(q->result, 0, ret);
     ret = (VALUE)NULL;
 
     /* decr internal handler mark */
Index: ext/tk/tkutil/tkutil.c
===================================================================
--- ext/tk/tkutil/tkutil.c	(revision 52455)
+++ ext/tk/tkutil/tkutil.c	(revision 52456)
@@ -481,7 +481,7 @@ ary2list(ary, enc_flag, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L481
             } else {
                 str_val = rb_funcall(cTclTkLib, ID_toUTF8, 1, str_val);
             }
-            RARRAY_PTR(dst)[idx] = str_val;
+            RARRAY_ASET(dst, idx, str_val);
         }
         val = rb_apply(cTclTkLib, ID_merge_tklist, dst);
         if (RB_TYPE_P(dst_enc, T_STRING)) {
@@ -575,7 +575,7 @@ ary2list2(ary, enc_flag, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L575
             } else {
                 str_val = rb_funcall(cTclTkLib, ID_toUTF8, 1, str_val);
             }
-            RARRAY_PTR(dst)[idx] = str_val;
+            RARRAY_ASET(dst, idx, str_val);
         }
         val = rb_apply(cTclTkLib, ID_merge_tklist, dst);
         if (RB_TYPE_P(dst_enc, T_STRING)) {
Index: ext/socket/socket.c
===================================================================
--- ext/socket/socket.c	(revision 52455)
+++ ext/socket/socket.c	(revision 52456)
@@ -1095,7 +1095,7 @@ make_addrinfo(struct rb_addrinfo *res0, https://github.com/ruby/ruby/blob/trunk/ext/socket/socket.c#L1095
     for (res = res0->ai; res; res = res->ai_next) {
 	ary = rsock_ipaddr(res->ai_addr, res->ai_addrlen, norevlookup);
 	if (res->ai_canonname) {
-	    RARRAY_PTR(ary)[2] = rb_str_new2(res->ai_canonname);
+	    RARRAY_ASET(ary, 2, rb_str_new2(res->ai_canonname));
 	}
 	rb_ary_push(ary, INT2FIX(res->ai_family));
 	rb_ary_push(ary, INT2FIX(res->ai_socktype));

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

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