diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-02 01:34:44 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-02 01:34:44 +0000 |
commit | 38fd0dc668dac293f4eb514aef76ee043181544c (patch) | |
tree | 6332049b0c5a17c29c52c4ff5a53120b8e82501e /ext | |
parent | a80b30041671d2b97c205e50c29fb25f35a292f0 (diff) | |
download | ruby-38fd0dc668dac293f4eb514aef76ee043181544c.tar.gz |
symbol/type.c: bug_pindown
* ext/-test-/symbol/type.c (bug_pindown): method for debug, which
pins down the given symbol.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/-test-/symbol/extconf.rb | 1 | ||||
-rw-r--r-- | ext/-test-/symbol/type.c | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/ext/-test-/symbol/extconf.rb b/ext/-test-/symbol/extconf.rb index 0b7c3876fa..fc00ec9abf 100644 --- a/ext/-test-/symbol/extconf.rb +++ b/ext/-test-/symbol/extconf.rb @@ -3,4 +3,5 @@ inits = $srcs.map {|s| File.basename(s, ".*")} 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") diff --git a/ext/-test-/symbol/type.c b/ext/-test-/symbol/type.c index c6dbdd1f8e..296c74c105 100644 --- a/ext/-test-/symbol/type.c +++ b/ext/-test-/symbol/type.c @@ -53,6 +53,17 @@ bug_dynamic_p(VALUE self, VALUE sym) 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) 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 } |