diff options
| author | frsyuki <frsyuki@users.sourceforge.jp> | 2010-05-26 18:11:09 +0900 |
|---|---|---|
| committer | frsyuki <frsyuki@users.sourceforge.jp> | 2010-05-26 18:11:09 +0900 |
| commit | 3fbcde4bd74e00e208b10aa00c389256de0ba317 (patch) | |
| tree | 1c75461742f974b0aee246d377980f4df42fc3c0 | |
| parent | 293293c23cf6672827248910f133b22d0d58fcf3 (diff) | |
| download | msgpack-python-3fbcde4bd74e00e208b10aa00c389256de0ba317.tar.gz | |
ruby: don't use rb_enc_set/get on ruby 1.8
| -rw-r--r-- | ruby/msgpack.gemspec | 2 | ||||
| -rw-r--r-- | ruby/unpack.c | 16 |
2 files changed, 12 insertions, 6 deletions
diff --git a/ruby/msgpack.gemspec b/ruby/msgpack.gemspec index 0f08628..e10622f 100644 --- a/ruby/msgpack.gemspec +++ b/ruby/msgpack.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = "msgpack" - s.version = "0.4.0" + s.version = "0.4.1" s.summary = "MessagePack, a binary-based efficient data interchange format." s.author = "FURUHASHI Sadayuki" s.email = "frsyuki@users.sourceforge.jp" diff --git a/ruby/unpack.c b/ruby/unpack.c index 65852b9..0f7b9f0 100644 --- a/ruby/unpack.c +++ b/ruby/unpack.c @@ -163,15 +163,17 @@ static inline int template_callback_raw(unpack_user* u, const char* b, const cha #endif -static VALUE template_execute_rescue(VALUE data) +#ifdef HAVE_RUBY_ENCODING_H +static VALUE template_execute_rescue_enc(VALUE data) { rb_gc_enable(); VALUE* resc = (VALUE*)data; rb_enc_set_index(resc[0], (int)resc[1]); RERAISE; } +#endif -static VALUE template_execute_rescue_each(VALUE nouse) +static VALUE template_execute_rescue(VALUE nouse) { rb_gc_enable(); RERAISE; @@ -211,10 +213,14 @@ static int template_execute_wrap(msgpack_unpack_t* mp, mp->user.source = str; +#ifdef HAVE_RUBY_ENCODING_H VALUE resc[2] = {str, enc_orig}; - int ret = (int)rb_rescue(template_execute_do, (VALUE)args, - template_execute_rescue, (VALUE)resc); + template_execute_rescue_enc, (VALUE)resc); +#else + int ret = (int)rb_rescue(template_execute_do, (VALUE)args, + template_execute_rescue, Qnil); +#endif rb_gc_enable(); @@ -241,7 +247,7 @@ static int template_execute_wrap_each(msgpack_unpack_t* mp, mp->user.source = Qnil; int ret = (int)rb_rescue(template_execute_do, (VALUE)args, - template_execute_rescue_each, Qnil); + template_execute_rescue, Qnil); rb_gc_enable(); |
