mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
81e9d9799a
commit
d29ff24793
6 changed files with 39 additions and 4 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Sat Dec 27 20:12:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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.
|
||||
|
||||
Sat Dec 27 16:54:05 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* process.c: Unused code removed.
|
||||
|
|
|
@ -518,8 +518,10 @@ static size_t State_memsize(const void *ptr)
|
|||
static const rb_data_type_t JSON_Generator_State_type = {
|
||||
"JSON/Generator/State",
|
||||
{NULL, State_free, State_memsize,},
|
||||
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
||||
0, 0,
|
||||
RUBY_TYPED_FREE_IMMEDIATELY,
|
||||
#endif
|
||||
};
|
||||
|
||||
static JSON_Generator_State *State_allocate(void)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2094,8 +2094,7 @@ static VALUE cParser_parse(VALUE self)
|
|||
|
||||
static JSON_Parser *JSON_allocate(void)
|
||||
{
|
||||
JSON_Parser *json = ALLOC(JSON_Parser);
|
||||
MEMZERO(json, JSON_Parser, 1);
|
||||
JSON_Parser *json = ZALLOC(JSON_Parser);
|
||||
json->fbuffer = fbuffer_alloc(0);
|
||||
return json;
|
||||
}
|
||||
|
@ -2126,8 +2125,10 @@ static size_t JSON_memsize(const void *ptr)
|
|||
static const rb_data_type_t JSON_Parser_type = {
|
||||
"JSON/Parser",
|
||||
{JSON_mark, JSON_free, JSON_memsize,},
|
||||
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
||||
0, 0,
|
||||
RUBY_TYPED_FREE_IMMEDIATELY,
|
||||
#endif
|
||||
};
|
||||
|
||||
static VALUE cJSON_parser_s_allocate(VALUE klass)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -817,8 +817,7 @@ static VALUE cParser_parse(VALUE self)
|
|||
|
||||
static JSON_Parser *JSON_allocate(void)
|
||||
{
|
||||
JSON_Parser *json = ALLOC(JSON_Parser);
|
||||
MEMZERO(json, JSON_Parser, 1);
|
||||
JSON_Parser *json = ZALLOC(JSON_Parser);
|
||||
json->fbuffer = fbuffer_alloc(0);
|
||||
return json;
|
||||
}
|
||||
|
@ -849,8 +848,10 @@ static size_t JSON_memsize(const void *ptr)
|
|||
static const rb_data_type_t JSON_Parser_type = {
|
||||
"JSON/Parser",
|
||||
{JSON_mark, JSON_free, JSON_memsize,},
|
||||
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
||||
0, 0,
|
||||
RUBY_TYPED_FREE_IMMEDIATELY,
|
||||
#endif
|
||||
};
|
||||
|
||||
static VALUE cJSON_parser_s_allocate(VALUE klass)
|
||||
|
|
Loading…
Reference in a new issue