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

ruby-changes:25256

From: ko1 <ko1@a...>
Date: Wed, 24 Oct 2012 10:22:22 +0900 (JST)
Subject: [ruby-changes:25256] ko1:r37308 (trunk): * ext/objspace/objspace.c (Init_objspace): add a new method

ko1	2012-10-24 10:21:13 +0900 (Wed, 24 Oct 2012)

  New Revision: 37308

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

  Log:
    * ext/objspace/objspace.c (Init_objspace): add a new method
      `ObjectSpace::InternalObjectWrapper#internal_object_id' which returns
      an object id of a wrapped internal object.

  Modified files:
    trunk/ChangeLog
    trunk/ext/objspace/objspace.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37307)
+++ ChangeLog	(revision 37308)
@@ -1,3 +1,9 @@
+Wed Oct 24 10:17:45 2012  Koichi Sasada  <ko1@a...>
+
+	* ext/objspace/objspace.c (Init_objspace): add a new method
+	  `ObjectSpace::InternalObjectWrapper#internal_object_id' which returns
+	  an object id of a wrapped internal object.
+
 Wed Oct 24 08:55:04 2012  Koichi Sasada  <ko1@a...>
 
 	* ext/objspace/objspace.c (ObjectSpace.reachable_objects_from):
Index: ext/objspace/objspace.c
===================================================================
--- ext/objspace/objspace.c	(revision 37307)
+++ ext/objspace/objspace.c	(revision 37308)
@@ -668,6 +668,13 @@
     return rb_sprintf("#<InternalObject:%p %s>", (void *)obj, rb_id2name(SYM2ID(type)));
 }
 
+static VALUE
+iow_internal_object_id(VALUE self)
+{
+    VALUE obj = (VALUE)DATA_PTR(self);
+    return rb_obj_id(obj);
+}
+
 struct rof_data {
     st_table *refs;
     VALUE internals;
@@ -787,4 +794,5 @@
     rb_mInternalObjectWrapper = rb_define_class_under(rb_mObjSpace, "InternalObjectWrapper", rb_cObject);
     rb_define_method(rb_mInternalObjectWrapper, "type", iow_type, 0);
     rb_define_method(rb_mInternalObjectWrapper, "inspect", iow_inspect, 0);
+    rb_define_method(rb_mInternalObjectWrapper, "internal_object_id", iow_internal_object_id, 0);
 }

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

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