mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-16 18:56:54 +02:00
ruby: don't use rb_enc_set/get on ruby 1.8
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.platform = Gem::Platform::RUBY
|
s.platform = Gem::Platform::RUBY
|
||||||
s.name = "msgpack"
|
s.name = "msgpack"
|
||||||
s.version = "0.4.0"
|
s.version = "0.4.1"
|
||||||
s.summary = "MessagePack, a binary-based efficient data interchange format."
|
s.summary = "MessagePack, a binary-based efficient data interchange format."
|
||||||
s.author = "FURUHASHI Sadayuki"
|
s.author = "FURUHASHI Sadayuki"
|
||||||
s.email = "frsyuki@users.sourceforge.jp"
|
s.email = "frsyuki@users.sourceforge.jp"
|
||||||
|
@@ -163,15 +163,17 @@ static inline int template_callback_raw(unpack_user* u, const char* b, const cha
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static VALUE template_execute_rescue(VALUE data)
|
#ifdef HAVE_RUBY_ENCODING_H
|
||||||
|
static VALUE template_execute_rescue_enc(VALUE data)
|
||||||
{
|
{
|
||||||
rb_gc_enable();
|
rb_gc_enable();
|
||||||
VALUE* resc = (VALUE*)data;
|
VALUE* resc = (VALUE*)data;
|
||||||
rb_enc_set_index(resc[0], (int)resc[1]);
|
rb_enc_set_index(resc[0], (int)resc[1]);
|
||||||
RERAISE;
|
RERAISE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static VALUE template_execute_rescue_each(VALUE nouse)
|
static VALUE template_execute_rescue(VALUE nouse)
|
||||||
{
|
{
|
||||||
rb_gc_enable();
|
rb_gc_enable();
|
||||||
RERAISE;
|
RERAISE;
|
||||||
@@ -211,10 +213,14 @@ static int template_execute_wrap(msgpack_unpack_t* mp,
|
|||||||
|
|
||||||
mp->user.source = str;
|
mp->user.source = str;
|
||||||
|
|
||||||
|
#ifdef HAVE_RUBY_ENCODING_H
|
||||||
VALUE resc[2] = {str, enc_orig};
|
VALUE resc[2] = {str, enc_orig};
|
||||||
|
|
||||||
int ret = (int)rb_rescue(template_execute_do, (VALUE)args,
|
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();
|
rb_gc_enable();
|
||||||
|
|
||||||
@@ -241,7 +247,7 @@ static int template_execute_wrap_each(msgpack_unpack_t* mp,
|
|||||||
mp->user.source = Qnil;
|
mp->user.source = Qnil;
|
||||||
|
|
||||||
int ret = (int)rb_rescue(template_execute_do, (VALUE)args,
|
int ret = (int)rb_rescue(template_execute_do, (VALUE)args,
|
||||||
template_execute_rescue_each, Qnil);
|
template_execute_rescue, Qnil);
|
||||||
|
|
||||||
rb_gc_enable();
|
rb_gc_enable();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user