summaryrefslogtreecommitdiff
path: root/ext/json/parser/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/parser/parser.h')
-rw-r--r--ext/json/parser/parser.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/json/parser/parser.h b/ext/json/parser/parser.h
index 45afbc2732..980999a6d7 100644
--- a/ext/json/parser/parser.h
+++ b/ext/json/parser/parser.h
@@ -75,4 +75,14 @@ static VALUE cJSON_parser_s_allocate(VALUE klass);
static VALUE cParser_source(VALUE self);
static const rb_data_type_t JSON_Parser_type;
+#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
+
#endif