From f5219fee6307461c7ead4358290958679d9d0d38 Mon Sep 17 00:00:00 2001 From: hsbt Date: Fri, 13 Feb 2015 05:19:12 +0000 Subject: * ext/json: merge upstream from flori/json change usage of TypedData. [Feature #10739][ruby-core:67564] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/json/parser/parser.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'ext/json/parser/parser.h') diff --git a/ext/json/parser/parser.h b/ext/json/parser/parser.h index 394b79a4ea..e98f26a297 100644 --- a/ext/json/parser/parser.h +++ b/ext/json/parser/parser.h @@ -49,15 +49,9 @@ typedef struct JSON_ParserStruct { #define GET_PARSER \ GET_PARSER_INIT; \ if (!json->Vsource) rb_raise(rb_eTypeError, "uninitialized instance") -#ifdef HAVE_TYPE_RB_DATA_TYPE_T #define GET_PARSER_INIT \ JSON_Parser *json; \ TypedData_Get_Struct(self, JSON_Parser, &JSON_Parser_type, json) -#else -#define GET_PARSER_INIT \ - JSON_Parser *json; \ - Data_Get_Struct(self, JSON_Parser, json) -#endif #define MinusInfinity "-Infinity" #define EVIL 0x666 @@ -79,10 +73,6 @@ static void JSON_mark(void *json); static void JSON_free(void *json); static VALUE cJSON_parser_s_allocate(VALUE klass); static VALUE cParser_source(VALUE self); -#ifdef HAVE_TYPE_RB_DATA_TYPE_T -static const rb_data_type_t JSON_Parser_type; -#endif - #ifndef ZALLOC #define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type))) static inline void *ruby_zalloc(size_t n) @@ -92,5 +82,12 @@ static inline void *ruby_zalloc(size_t n) return p; } #endif +#ifdef TypedData_Wrap_Struct +static const rb_data_type_t JSON_Parser_type; +#define NEW_TYPEDDATA_WRAPPER 1 +#else +#define TypedData_Wrap_Struct(klass, ignore, json) Data_Wrap_Struct(klass, JSON_mark, JSON_free, json) +#define TypedData_Get_Struct(self, JSON_Parser, ignore, json) Data_Get_Struct(self, JSON_Parser, json) +#endif #endif -- cgit v1.2.3