aboutsummaryrefslogtreecommitdiffstats
path: root/ext/json/generator/generator.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-27 11:12:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-27 11:12:58 +0000
commitd29ff247936236673cf117cff558f55c787750a8 (patch)
treea411d51ef37a52160c5deff7220a99ba0147fd6c /ext/json/generator/generator.h
parent81e9d9799a0911058157404c1976f00598fc7b6a (diff)
downloadruby-d29ff247936236673cf117cff558f55c787750a8.tar.gz
json: backward compatibilities
* ext/json/generator/generator.c (JSON_Generator_State_type): add #ifdef for backward compatibility. * ext/json/parser/parser.rl (JSON_Parser_type): ditto. * ext/json/generator/generator.h (ZALLOC): add fallback definition. * ext/json/parser/parser.h (ZALLOC): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json/generator/generator.h')
-rw-r--r--ext/json/generator/generator.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/json/generator/generator.h b/ext/json/generator/generator.h
index ddd1aa8a30..9277682603 100644
--- a/ext/json/generator/generator.h
+++ b/ext/json/generator/generator.h
@@ -149,4 +149,14 @@ static VALUE cState_depth_set(VALUE self, VALUE depth);
static FBuffer *cState_prepare_buffer(VALUE self);
static const rb_data_type_t JSON_Generator_State_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