summaryrefslogtreecommitdiff
path: root/ext/json/parser/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/parser/parser.c')
-rw-r--r--ext/json/parser/parser.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c
index b9f753c..b692cb4 100644
--- a/ext/json/parser/parser.c
+++ b/ext/json/parser/parser.c
@@ -2122,6 +2122,7 @@ static size_t JSON_memsize(const void *ptr)
return sizeof(*json) + FBUFFER_CAPA(json->fbuffer);
}
+#ifdef HAVE_TYPE_RB_DATA_TYPE_T
static const rb_data_type_t JSON_Parser_type = {
"JSON/Parser",
{JSON_mark, JSON_free, JSON_memsize,},
@@ -2130,11 +2131,16 @@ static const rb_data_type_t JSON_Parser_type = {
RUBY_TYPED_FREE_IMMEDIATELY,
#endif
};
+#endif
static VALUE cJSON_parser_s_allocate(VALUE klass)
{
JSON_Parser *json = JSON_allocate();
+#ifdef HAVE_TYPE_RB_DATA_TYPE_T
return TypedData_Wrap_Struct(klass, &JSON_Parser_type, json);
+#else
+ return Data_Wrap_Struct(klass, JSON_mark, JSON_free, json);
+#endif
}
/*