aboutsummaryrefslogtreecommitdiffstats
path: root/ext/json/parser/parser.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-28 07:17:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-28 07:17:42 +0000
commit60b0c53ea28606e2d0e2c7ab22978792a4f52189 (patch)
treedc15beb24155ca79411233af59b3b96154032a88 /ext/json/parser/parser.h
parent52c0280a74fc06b2e596556d7f957afd80648fa2 (diff)
downloadruby-60b0c53ea28606e2d0e2c7ab22978792a4f52189.tar.gz
parser.rl: allocate structs with wrapper
* ext/json/parser/parser.rl (cJSON_parser_s_allocate): allocate structs with making new wrapper objects and get rid of potential memory leak. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json/parser/parser.h')
-rw-r--r--ext/json/parser/parser.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/json/parser/parser.h b/ext/json/parser/parser.h
index e98f26a297..abcc2571f1 100644
--- a/ext/json/parser/parser.h
+++ b/ext/json/parser/parser.h
@@ -68,7 +68,6 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
static VALUE convert_encoding(VALUE source);
static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self);
static VALUE cParser_parse(VALUE self);
-static JSON_Parser *JSON_allocate(void);
static void JSON_mark(void *json);
static void JSON_free(void *json);
static VALUE cJSON_parser_s_allocate(VALUE klass);
@@ -82,11 +81,11 @@ static inline void *ruby_zalloc(size_t n)
return p;
}
#endif
-#ifdef TypedData_Wrap_Struct
+#ifdef TypedData_Make_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_Make_Struct(klass, type, ignore, json) Data_Make_Struct(klass, type, NULL, JSON_free, json)
#define TypedData_Get_Struct(self, JSON_Parser, ignore, json) Data_Get_Struct(self, JSON_Parser, json)
#endif