From d29ff247936236673cf117cff558f55c787750a8 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 27 Dec 2014 11:12:58 +0000 Subject: 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 --- ext/json/parser/parser.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ext/json/parser/parser.h') 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 -- cgit v1.2.3