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

ruby-changes:4114

From: ko1@a...
Date: Tue, 26 Feb 2008 01:18:44 +0900 (JST)
Subject: [ruby-changes:4114] akr - Ruby:r15604 (trunk): * include/ruby/ruby.h (ROBJECT_NUMIV): renamed from ROBJECT_LEN.

akr	2008-02-26 01:18:18 +0900 (Tue, 26 Feb 2008)

  New Revision: 15604

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
    trunk/include/ruby/ruby.h
    trunk/marshal.c
    trunk/object.c
    trunk/variable.c

  Log:
    * include/ruby/ruby.h (ROBJECT_NUMIV): renamed from ROBJECT_LEN.
      (ROBJECT_IVPTR): renamed from ROBJECT_PTR.
    
    * variable.c: follow the above renaming.
    
    * object.c: ditto.
    
    * gc.c: ditto.
    
    * marshal.c: ditto.
    


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/ruby.h?r1=15604&r2=15603&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/variable.c?r1=15604&r2=15603&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15604&r2=15603&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/gc.c?r1=15604&r2=15603&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/marshal.c?r1=15604&r2=15603&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/object.c?r1=15604&r2=15603&diff_format=u

Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 15603)
+++ include/ruby/ruby.h	(revision 15604)
@@ -396,22 +396,22 @@
     struct RBasic basic;
     union {
 	struct {
-	    long len;
-	    VALUE *ptr;
+	    long numiv;
+	    VALUE *ivptr;
             struct st_table *iv_index_tbl; /* shortcut for RCLASS_IV_INDEX_TBL(rb_obj_class(obj)) */
 	} heap;
 	VALUE ary[ROBJECT_EMBED_LEN_MAX];
     } as;
 };
 #define ROBJECT_EMBED FL_USER1
-#define ROBJECT_LEN(o) \
+#define ROBJECT_NUMIV(o) \
     ((RBASIC(o)->flags & ROBJECT_EMBED) ? \
      ROBJECT_EMBED_LEN_MAX : \
-     ROBJECT(o)->as.heap.len)
-#define ROBJECT_PTR(o) \
+     ROBJECT(o)->as.heap.numiv)
+#define ROBJECT_IVPTR(o) \
     ((RBASIC(o)->flags & ROBJECT_EMBED) ? \
      ROBJECT(o)->as.ary : \
-     ROBJECT(o)->as.heap.ptr)
+     ROBJECT(o)->as.heap.ivptr)
 #define ROBJECT_IV_INDEX_TBL(o) \
     ((RBASIC(o)->flags & ROBJECT_EMBED) ? \
      RCLASS_IV_INDEX_TBL(rb_obj_class(o)) : \
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15603)
+++ ChangeLog	(revision 15604)
@@ -1,3 +1,16 @@
+Tue Feb 26 01:16:01 2008  Tanaka Akira  <akr@f...>
+
+	* include/ruby/ruby.h (ROBJECT_NUMIV): renamed from ROBJECT_LEN.
+	  (ROBJECT_IVPTR): renamed from ROBJECT_PTR.
+
+	* variable.c: follow the above renaming.
+
+	* object.c: ditto.
+
+	* gc.c: ditto.
+
+	* marshal.c: ditto.
+
 Mon Feb 25 17:30:29 2008  Technorama Ltd.  <oss-ruby@t...>
 
 	* ext/openssl/digest.c ext/openssl/lib/openssl/digest.rb:
Index: variable.c
===================================================================
--- variable.c	(revision 15603)
+++ variable.c	(revision 15604)
@@ -939,8 +939,8 @@
 
     switch (TYPE(obj)) {
       case T_OBJECT:
-        len = ROBJECT_LEN(obj);
-        ptr = ROBJECT_PTR(obj);
+        len = ROBJECT_NUMIV(obj);
+        ptr = ROBJECT_IVPTR(obj);
         iv_index_tbl = ROBJECT_IV_INDEX_TBL(obj);
         if (!iv_index_tbl) break; 
         if (!st_lookup(iv_index_tbl, id, &index)) break;
@@ -1004,9 +1004,9 @@
             st_add_direct(iv_index_tbl, id, index);
             ivar_extended = 1;
         }
-        len = ROBJECT_LEN(obj);
+        len = ROBJECT_NUMIV(obj);
         if (len <= index) {
-            VALUE *ptr = ROBJECT_PTR(obj);
+            VALUE *ptr = ROBJECT_IVPTR(obj);
             if (index < ROBJECT_EMBED_LEN_MAX) {
                 RBASIC(obj)->flags |= ROBJECT_EMBED;
                 ptr = ROBJECT(obj)->as.ary;
@@ -1025,19 +1025,19 @@
                     newptr = ALLOC_N(VALUE, newsize);
                     MEMCPY(newptr, ptr, VALUE, len);
                     RBASIC(obj)->flags &= ~ROBJECT_EMBED;
-                    ROBJECT(obj)->as.heap.ptr = newptr;
+                    ROBJECT(obj)->as.heap.ivptr = newptr;
                 }
                 else {
-                    REALLOC_N(ROBJECT(obj)->as.heap.ptr, VALUE, newsize);
-                    newptr = ROBJECT(obj)->as.heap.ptr;
+                    REALLOC_N(ROBJECT(obj)->as.heap.ivptr, VALUE, newsize);
+                    newptr = ROBJECT(obj)->as.heap.ivptr;
                 }
                 for (; len < newsize; len++)
                     newptr[len] = Qundef;
-                ROBJECT(obj)->as.heap.len = newsize;
+                ROBJECT(obj)->as.heap.numiv = newsize;
                 ROBJECT(obj)->as.heap.iv_index_tbl = iv_index_tbl;
             }
         }
-        ROBJECT_PTR(obj)[index] = val;
+        ROBJECT_IVPTR(obj)[index] = val;
 	break;
       case T_CLASS:
       case T_MODULE:
@@ -1062,8 +1062,8 @@
         iv_index_tbl = ROBJECT_IV_INDEX_TBL(obj);
         if (!iv_index_tbl) break;
         if (!st_lookup(iv_index_tbl, id, &index)) break;
-        if (ROBJECT_LEN(obj) <= index) break;
-        val = ROBJECT_PTR(obj)[index];
+        if (ROBJECT_NUMIV(obj) <= index) break;
+        val = ROBJECT_IVPTR(obj)[index];
         if (val != Qundef)
             return Qtrue;
 	break;
@@ -1089,8 +1089,8 @@
 static int
 obj_ivar_i(ID key, VALUE index, struct obj_ivar_tag *data)
 {
-    if (index < ROBJECT_LEN(data->obj)) {
-        VALUE val = ROBJECT_PTR(data->obj)[index];
+    if (index < ROBJECT_NUMIV(data->obj)) {
+        VALUE val = ROBJECT_IVPTR(data->obj)[index];
         if (val != Qundef) {
             return (data->func)(key, val, data->arg);
         }
@@ -1218,10 +1218,10 @@
         iv_index_tbl = ROBJECT_IV_INDEX_TBL(obj);
         if (!iv_index_tbl) break;
         if (!st_lookup(iv_index_tbl, id, &index)) break;
-        if (ROBJECT_LEN(obj) <= index) break;
-        val = ROBJECT_PTR(obj)[index];
+        if (ROBJECT_NUMIV(obj) <= index) break;
+        val = ROBJECT_IVPTR(obj)[index];
         if (val != Qundef) {
-            ROBJECT_PTR(obj)[index] = Qundef;
+            ROBJECT_IVPTR(obj)[index] = Qundef;
             return val;
         }
 	break;
Index: object.c
===================================================================
--- object.c	(revision 15603)
+++ object.c	(revision 15604)
@@ -166,10 +166,10 @@
     rb_gc_copy_finalizer(dest, obj);
     switch (TYPE(obj)) {
       case T_OBJECT:
-        if (!(RBASIC(dest)->flags & ROBJECT_EMBED) && ROBJECT_PTR(dest)) {
-            xfree(ROBJECT_PTR(dest));
-            ROBJECT(dest)->as.heap.ptr = 0;
-            ROBJECT(dest)->as.heap.len = 0;
+        if (!(RBASIC(dest)->flags & ROBJECT_EMBED) && ROBJECT_IVPTR(dest)) {
+            xfree(ROBJECT_IVPTR(dest));
+            ROBJECT(dest)->as.heap.ivptr = 0;
+            ROBJECT(dest)->as.heap.numiv = 0;
             ROBJECT(dest)->as.heap.iv_index_tbl = 0;
         }
         if (RBASIC(obj)->flags & ROBJECT_EMBED) {
@@ -177,11 +177,11 @@
             RBASIC(dest)->flags |= ROBJECT_EMBED;
         }
         else {
-            long len = ROBJECT(obj)->as.heap.len;
+            long len = ROBJECT(obj)->as.heap.numiv;
             VALUE *ptr = ALLOC_N(VALUE, len);
-            MEMCPY(ptr, ROBJECT(obj)->as.heap.ptr, VALUE, len);
-            ROBJECT(dest)->as.heap.ptr = ptr;
-            ROBJECT(dest)->as.heap.len = len;
+            MEMCPY(ptr, ROBJECT(obj)->as.heap.ivptr, VALUE, len);
+            ROBJECT(dest)->as.heap.ivptr = ptr;
+            ROBJECT(dest)->as.heap.numiv = len;
             ROBJECT(dest)->as.heap.iv_index_tbl = ROBJECT(obj)->as.heap.iv_index_tbl;
             RBASIC(dest)->flags &= ~ROBJECT_EMBED;
         }
@@ -374,8 +374,8 @@
 
     if (TYPE(obj) == T_OBJECT) {
         int has_ivar = 0;
-        VALUE *ptr = ROBJECT_PTR(obj);
-        long len = ROBJECT_LEN(obj);
+        VALUE *ptr = ROBJECT_IVPTR(obj);
+        long len = ROBJECT_NUMIV(obj);
         long i;
 
         for (i = 0; i < len; i++) {
Index: gc.c
===================================================================
--- gc.c	(revision 15603)
+++ gc.c	(revision 15604)
@@ -1065,8 +1065,8 @@
 
       case T_OBJECT:
         {
-            long i, len = ROBJECT_LEN(obj);
-	    VALUE *ptr = ROBJECT_PTR(obj);
+            long i, len = ROBJECT_NUMIV(obj);
+	    VALUE *ptr = ROBJECT_IVPTR(obj);
             for (i  = 0; i < len; i++) {
 		gc_mark(*ptr++, lev);
             }
@@ -1274,8 +1274,8 @@
     switch (RANY(obj)->as.basic.flags & T_MASK) {
       case T_OBJECT:
 	if (!(RANY(obj)->as.basic.flags & ROBJECT_EMBED) &&
-            RANY(obj)->as.object.as.heap.ptr) {
-	    RUBY_CRITICAL(free(RANY(obj)->as.object.as.heap.ptr));
+            RANY(obj)->as.object.as.heap.ivptr) {
+	    RUBY_CRITICAL(free(RANY(obj)->as.object.as.heap.ivptr));
 	}
 	break;
       case T_MODULE:
Index: marshal.c
===================================================================
--- marshal.c	(revision 15603)
+++ marshal.c	(revision 15604)
@@ -505,8 +505,8 @@
     VALUE *ptr;
     long i, len, num;
 
-    len = ROBJECT_LEN(obj);
-    ptr = ROBJECT_PTR(obj);
+    len = ROBJECT_NUMIV(obj);
+    ptr = ROBJECT_IVPTR(obj);
     num = 0;
     for (i = 0; i < len; i++)
         if (ptr[i] != Qundef)

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

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