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

ruby-changes:28637

From: ko1 <ko1@a...>
Date: Mon, 13 May 2013 18:42:00 +0900 (JST)
Subject: [ruby-changes:28637] ko1:r40689 (trunk): * include/ruby/ruby.h: add new utility macros to access

ko1	2013-05-13 18:41:48 +0900 (Mon, 13 May 2013)

  New Revision: 40689

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

  Log:
    * include/ruby/ruby.h: add new utility macros to access
      Array's element.
    * RARRAY_AREF(a, i) returns i-th element of an array `a'
    * RARRAY_ASET(a, i, v) set i-th element of `a' to `v'
      This change is a part of RGENGC branch [ruby-trunk - Feature #8339].

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/ruby.h

Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 40688)
+++ include/ruby/ruby.h	(revision 40689)
@@ -892,6 +892,9 @@ struct RArray { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L892
      RARRAY(a)->as.heap.ptr)
 #define RARRAY_LENINT(ary) rb_long2int(RARRAY_LEN(ary))
 
+#define RARRAY_AREF(a, i)    (RARRAY_PTR(a)[i])
+#define RARRAY_ASET(a, i, v) do {RARRAY_PTR(a)[i] = (v);} while (0)
+
 struct RRegexp {
     struct RBasic basic;
     struct re_pattern_buffer *ptr;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40688)
+++ ChangeLog	(revision 40689)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon May 13 16:53:53 2013  Koichi Sasada  <ko1@a...>
+
+	* include/ruby/ruby.h: add new utility macros to access
+	  Array's element.
+	  * RARRAY_AREF(a, i) returns i-th element of an array `a'
+	  * RARRAY_ASET(a, i, v) set i-th element of `a' to `v'
+	  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
+
 Mon May 13 15:31:10 2013  Koichi Sasada  <ko1@a...>
 
 	* object.c (rb_obj_setup): added.

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

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