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

ruby-changes:33699

From: nobu <ko1@a...>
Date: Fri, 2 May 2014 10:34:50 +0900 (JST)
Subject: [ruby-changes:33699] nobu:r45780 (trunk): symbol/type.c: bug_pindown

nobu	2014-05-02 10:34:44 +0900 (Fri, 02 May 2014)

  New Revision: 45780

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

  Log:
    symbol/type.c: bug_pindown
    
    * ext/-test-/symbol/type.c (bug_pindown): method for debug, which
      pins down the given symbol.

  Modified files:
    trunk/ext/-test-/symbol/extconf.rb
    trunk/ext/-test-/symbol/type.c
Index: ext/-test-/symbol/type.c
===================================================================
--- ext/-test-/symbol/type.c	(revision 45779)
+++ ext/-test-/symbol/type.c	(revision 45780)
@@ -53,6 +53,17 @@ bug_dynamic_p(VALUE self, VALUE sym) https://github.com/ruby/ruby/blob/trunk/ext/-test-/symbol/type.c#L53
     return DYNAMIC_SYM_P(sym) ? Qtrue : Qfalse;
 }
 
+#ifdef HAVE_RB_PIN_DYNAMIC_SYMBOL
+ID rb_pin_dynamic_symbol(VALUE);
+
+static VALUE
+bug_pindown(VALUE self, VALUE sym)
+{
+    rb_pin_dynamic_symbol(sym);
+    return sym;
+}
+#endif
+
 void
 Init_type(VALUE klass)
 {
@@ -61,4 +72,7 @@ Init_type(VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/-test-/symbol/type.c#L72
     rb_define_singleton_method(klass, "id2str", bug_id2str, 1);
     rb_define_singleton_method(klass, "static?", bug_static_p, 1);
     rb_define_singleton_method(klass, "dynamic?", bug_dynamic_p, 1);
+#ifdef HAVE_RB_PIN_DYNAMIC_SYMBOL
+    rb_define_singleton_method(klass, "pindown", bug_pindown, 1);
+#endif
 }
Index: ext/-test-/symbol/extconf.rb
===================================================================
--- ext/-test-/symbol/extconf.rb	(revision 45779)
+++ ext/-test-/symbol/extconf.rb	(revision 45780)
@@ -3,4 +3,5 @@ inits = $srcs.map {|s| File.basename(s, https://github.com/ruby/ruby/blob/trunk/ext/-test-/symbol/extconf.rb#L3
 inits.delete("init")
 inits.map! {|s|"X(#{s})"}
 $defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
+have_func("rb_pin_dynamic_symbol")
 create_makefile("-test-/symbol")

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

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