diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-28 17:03:36 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-28 17:03:36 +0000 |
commit | 5547719573c6b37566480eaadf0c17bd0c5529bd (patch) | |
tree | 10ed6697d04576a68cbe11d6d71b4ebcb08616e3 /ext/json/generator | |
parent | d9f384d4304228bb4301c68d45cb9d89986f060f (diff) | |
download | ruby-5547719573c6b37566480eaadf0c17bd0c5529bd.tar.gz |
ext/json: for ancient backward compatibilities
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json/generator')
-rw-r--r-- | ext/json/generator/generator.c | 6 | ||||
-rw-r--r-- | ext/json/generator/generator.h | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/ext/json/generator/generator.c b/ext/json/generator/generator.c index 673da3320c..1b7f036a5d 100644 --- a/ext/json/generator/generator.c +++ b/ext/json/generator/generator.c @@ -515,6 +515,7 @@ static size_t State_memsize(const void *ptr) return size; } +#ifdef HAVE_TYPE_RB_DATA_TYPE_T static const rb_data_type_t JSON_Generator_State_type = { "JSON/Generator/State", {NULL, State_free, State_memsize,}, @@ -523,6 +524,7 @@ static const rb_data_type_t JSON_Generator_State_type = { RUBY_TYPED_FREE_IMMEDIATELY, #endif }; +#endif static JSON_Generator_State *State_allocate(void) { @@ -533,7 +535,11 @@ static JSON_Generator_State *State_allocate(void) static VALUE cState_s_allocate(VALUE klass) { JSON_Generator_State *state = State_allocate(); +#ifdef HAVE_TYPE_RB_DATA_TYPE_T return TypedData_Wrap_Struct(klass, &JSON_Generator_State_type, state); +#else + return Data_Wrap_Struct(klass, NULL, State_free, state); +#endif } /* diff --git a/ext/json/generator/generator.h b/ext/json/generator/generator.h index 6cfb8ac739..a583971d9f 100644 --- a/ext/json/generator/generator.h +++ b/ext/json/generator/generator.h @@ -78,8 +78,13 @@ typedef struct JSON_Generator_StateStruct { long buffer_initial_length; } JSON_Generator_State; +#ifdef HAVE_TYPE_RB_DATA_TYPE_T #define GET_STATE_TO(self, state) \ TypedData_Get_Struct(self, JSON_Generator_State, &JSON_Generator_State_type, state) +#else +#define GET_STATE_TO(self, state) \ + Data_Get_Struct(self, JSON_Generator_State, state) +#endif #define GET_STATE(self) \ JSON_Generator_State *state; \ @@ -147,7 +152,9 @@ static VALUE cState_ascii_only_p(VALUE self); static VALUE cState_depth(VALUE self); static VALUE cState_depth_set(VALUE self, VALUE depth); static FBuffer *cState_prepare_buffer(VALUE self); +#ifdef HAVE_TYPE_RB_DATA_TYPE_T static const rb_data_type_t JSON_Generator_State_type; +#endif #ifndef ZALLOC #define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type))) |