diff options
author | Takashi Tamura <tamuratak@users.noreply.github.com> | 2017-02-22 12:25:27 +0900 |
---|---|---|
committer | Takashi Tamura <tamuratak@users.noreply.github.com> | 2017-02-22 12:25:27 +0900 |
commit | 04a7c4f8b87a77758b9350ffc7c193cbcdcf229d (patch) | |
tree | 216a30843892fe956665c69ad38ff0094297c5ca /Lib/ruby/rubywstrings.swg | |
parent | e7eece9bcded750f51518e3356da2120eb4c05fd (diff) | |
download | swig-04a7c4f8b87a77758b9350ffc7c193cbcdcf229d.tar.gz |
[ruby] should initialize static variables inside %init{}, in which it will not be
excuted concurrently by multiple threads.
Diffstat (limited to 'Lib/ruby/rubywstrings.swg')
-rw-r--r-- | Lib/ruby/rubywstrings.swg | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/ruby/rubywstrings.swg b/Lib/ruby/rubywstrings.swg index 54724b268..93d0da21d 100644 --- a/Lib/ruby/rubywstrings.swg +++ b/Lib/ruby/rubywstrings.swg @@ -8,7 +8,7 @@ SWIGINTERN int SWIG_AsWCharPtrAndSize(VALUE obj, wchar_t **cptr, size_t *psize, int *alloc) { - static rb_encoding* wstr_enc = rb_to_encoding(rb_str_new_cstr( SWIG_RUBY_WSTRING_ENCODING )); + rb_encoding* wstr_enc = swig_ruby_wstring_encoding; if (TYPE(obj) == T_STRING) { VALUE rstr = rb_str_conv_enc(obj, rb_enc_get(obj), wstr_enc); @@ -37,8 +37,8 @@ SWIG_AsWCharPtrAndSize(VALUE obj, wchar_t **cptr, size_t *psize, int *alloc) SWIGINTERNINLINE VALUE SWIG_FromWCharPtrAndSize(const wchar_t * carray, size_t size) { - static rb_encoding* wstr_enc = rb_to_encoding(rb_str_new_cstr( SWIG_RUBY_WSTRING_ENCODING )); - static rb_encoding* rb_enc = rb_to_encoding(rb_str_new_cstr( SWIG_RUBY_INTERNAL_ENCODING )); + rb_encoding* wstr_enc = swig_ruby_wstring_encoding; + rb_encoding* rb_enc = swig_ruby_internal_encoding; if (carray && size <= LONG_MAX/sizeof(wchar_t)) { VALUE rstr = rb_str_new( (const char*)carray, %numeric_cast(size*sizeof(wchar_t),long) ); |