diff options
author | Gonzalo Garramuno <ggarra@advancedsl.com.ar> | 2007-09-04 05:40:49 +0000 |
---|---|---|
committer | Gonzalo Garramuno <ggarra@advancedsl.com.ar> | 2007-09-04 05:40:49 +0000 |
commit | 8f6e08dcb5796a6b65199fe959e8bb82f3824285 (patch) | |
tree | 5f97dc86d5c65f1e6eeb9754ab9a46039314cc44 /Lib/ruby | |
parent | 94323e0d52d8b11e25f362bb6b4467b36b0bd7e6 (diff) | |
download | swig-8f6e08dcb5796a6b65199fe959e8bb82f3824285.tar.gz |
Silly gcc was complaining about static initializers when
compiling in C.
Code was now moved to initialization and variables were
prefixed with swig_*.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9925 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib/ruby')
-rw-r--r-- | Lib/ruby/rubyrun.swg | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/ruby/rubyrun.swg b/Lib/ruby/rubyrun.swg index 9f3228c01..cb921c26e 100644 --- a/Lib/ruby/rubyrun.swg +++ b/Lib/ruby/rubyrun.swg @@ -77,7 +77,8 @@ typedef struct { static VALUE _cSWIG_Pointer = Qnil; static VALUE swig_runtime_data_type_pointer = Qnil; - +static VALUE swig_arity_id = Qnil; +static VALUE swig_call_id = Qnil; /* If your swig extension is to be run within an embedded ruby and has @@ -140,6 +141,8 @@ SWIG_Ruby_InitRuntime(void) { if (_mSWIG == Qnil) { _mSWIG = rb_define_module("SWIG"); + swig_call_id = rb_intern("call"); + swig_arity_id = rb_intern("arity"); } } @@ -404,8 +407,7 @@ SWIG_Ruby_SetModule(swig_module_info *pointer) SWIGINTERN int SWIG_Ruby_isCallable( VALUE proc ) { - static VALUE call_id = rb_intern("call"); - if ( rb_respond_to( proc, call_id ) == Qtrue ) + if ( rb_respond_to( proc, swig_call_id ) == Qtrue ) return 1; return 0; } @@ -418,10 +420,9 @@ int SWIG_Ruby_isCallable( VALUE proc ) SWIGINTERN int SWIG_Ruby_arity( VALUE proc, int minimal ) { - static VALUE arity_id = rb_intern("arity"); - if ( rb_respond_to( proc, arity_id ) == Qtrue ) + if ( rb_respond_to( proc, swig_arity_id ) == Qtrue ) { - VALUE num = rb_funcall( proc, arity_id, 0 ); + VALUE num = rb_funcall( proc, swig_arity_id, 0 ); int arity = NUM2INT(num); if ( arity < 0 && (arity+1) < -minimal ) return 1; if ( arity == minimal ) return 1; |