summaryrefslogtreecommitdiff
path: root/ext/json/ext/parser/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/ext/parser/parser.h')
-rw-r--r--ext/json/ext/parser/parser.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/json/ext/parser/parser.h b/ext/json/ext/parser/parser.h
index 418637f..e98f26a 100644
--- a/ext/json/ext/parser/parser.h
+++ b/ext/json/ext/parser/parser.h
@@ -73,6 +73,15 @@ 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);
+#ifndef ZALLOC
+#define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type)))
+static inline void *ruby_zalloc(size_t n)
+{
+ void *p = ruby_xmalloc(n);
+ memset(p, 0, n);
+ return p;
+}
+#endif
#ifdef TypedData_Wrap_Struct
static const rb_data_type_t JSON_Parser_type;
#define NEW_TYPEDDATA_WRAPPER 1