summaryrefslogtreecommitdiff
path: root/ext/-test-
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-08 05:20:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-08 05:20:41 +0000
commit1fadd438811426523a79ccea93a45f0a202a50f6 (patch)
tree4b6ed75880270e5280b4f051d96945f48ea20e35 /ext/-test-
parent95184065445e2888a624911214db67fe3695ec85 (diff)
marshal.c: skip internal names
* marshal.c (w_objivar): skip internal instance variables in T_OBJECT too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/-test-')
-rw-r--r--ext/-test-/marshal/internal_ivar/extconf.rb1
-rw-r--r--ext/-test-/marshal/internal_ivar/internal_ivar.c39
2 files changed, 40 insertions, 0 deletions
diff --git a/ext/-test-/marshal/internal_ivar/extconf.rb b/ext/-test-/marshal/internal_ivar/extconf.rb
new file mode 100644
index 0000000..9b905d9
--- /dev/null
+++ b/ext/-test-/marshal/internal_ivar/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/marshal/internal_ivar")
diff --git a/ext/-test-/marshal/internal_ivar/internal_ivar.c b/ext/-test-/marshal/internal_ivar/internal_ivar.c
new file mode 100644
index 0000000..299da27
--- /dev/null
+++ b/ext/-test-/marshal/internal_ivar/internal_ivar.c
@@ -0,0 +1,39 @@
+#include <ruby.h>
+
+static ID id_normal_ivar, id_internal_ivar;
+
+static VALUE
+init(VALUE self, VALUE arg1, VALUE arg2)
+{
+ rb_ivar_set(self, id_normal_ivar, arg1);
+ rb_ivar_set(self, id_internal_ivar, arg2);
+ return self;
+}
+
+static VALUE
+get_normal(VALUE self)
+{
+ return rb_attr_get(self, id_normal_ivar);
+}
+
+static VALUE
+get_internal(VALUE self)
+{
+ return rb_attr_get(self, id_internal_ivar);
+}
+
+void
+Init_internal_ivar(void)
+{
+ VALUE mMarshal = rb_define_module_under(rb_define_module("Bug"), "Marshal");
+ VALUE newclass = rb_define_class_under(mMarshal, "InternalIVar", rb_cObject);
+
+ id_normal_ivar = rb_intern_const("normal");
+#if 0
+ /* leave id_internal_ivar being 0 */
+ id_internal_ivar = rb_make_internal_id();
+#endif
+ rb_define_method(newclass, "initialize", init, 2);
+ rb_define_method(newclass, "normal", get_normal, 0);
+ rb_define_method(newclass, "internal", get_internal, 0);
+}