* ext/json/ext/parser/parse.c: use ruby_xfree().

* ext/json/ext/parser/parse.rl: ditto.

* ext/json/ext/parser/unicode.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-09-20 17:54:46 +00:00
parent e8eb95ec33
commit 55f9cc806d
4 changed files with 14 additions and 6 deletions

View File

@ -1,3 +1,11 @@
Sun Sep 21 02:48:45 2008 NARUSE, Yui <naruse@ruby-lang.org>
* ext/json/ext/parser/parse.c: use ruby_xfree().
* ext/json/ext/parser/parse.rl: ditto.
* ext/json/ext/parser/unicode.c: ditto.
Sun Sep 21 02:40:20 2008 NARUSE, Yui <naruse@ruby-lang.org> Sun Sep 21 02:40:20 2008 NARUSE, Yui <naruse@ruby-lang.org>
* ext/json: import JSON v 1.1.3. * ext/json: import JSON v 1.1.3.

View File

@ -1708,7 +1708,7 @@ static void JSON_mark(JSON_Parser *json)
static void JSON_free(JSON_Parser *json) static void JSON_free(JSON_Parser *json)
{ {
free(json); ruby_xfree(json);
} }
static VALUE cJSON_parser_s_allocate(VALUE klass) static VALUE cJSON_parser_s_allocate(VALUE klass)

View File

@ -588,7 +588,7 @@ static void JSON_mark(JSON_Parser *json)
static void JSON_free(JSON_Parser *json) static void JSON_free(JSON_Parser *json)
{ {
free(json); ruby_xfree(json);
} }
static VALUE cJSON_parser_s_allocate(VALUE klass) static VALUE cJSON_parser_s_allocate(VALUE klass)

View File

@ -103,12 +103,12 @@ char *JSON_convert_UTF16_to_UTF8 (
+ (ch2 - UNI_SUR_LOW_START) + halfBase; + (ch2 - UNI_SUR_LOW_START) + halfBase;
++tmpPtr; ++tmpPtr;
} else if (flags == strictConversion) { /* it's an unpaired high surrogate */ } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
free(tmp); ruby_xfree(tmp);
rb_raise(rb_path2class("JSON::ParserError"), rb_raise(rb_path2class("JSON::ParserError"),
"source sequence is illegal/malformed near %s", source); "source sequence is illegal/malformed near %s", source);
} }
} else { /* We don't have the 16 bits following the high surrogate. */ } else { /* We don't have the 16 bits following the high surrogate. */
free(tmp); ruby_xfree(tmp);
rb_raise(rb_path2class("JSON::ParserError"), rb_raise(rb_path2class("JSON::ParserError"),
"partial character in source, but hit end near %s", source); "partial character in source, but hit end near %s", source);
break; break;
@ -116,7 +116,7 @@ char *JSON_convert_UTF16_to_UTF8 (
} else if (flags == strictConversion) { } else if (flags == strictConversion) {
/* UTF-16 surrogate values are illegal in UTF-32 */ /* UTF-16 surrogate values are illegal in UTF-32 */
if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) { if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
free(tmp); ruby_xfree(tmp);
rb_raise(rb_path2class("JSON::ParserError"), rb_raise(rb_path2class("JSON::ParserError"),
"source sequence is illegal/malformed near %s", source); "source sequence is illegal/malformed near %s", source);
} }
@ -148,7 +148,7 @@ char *JSON_convert_UTF16_to_UTF8 (
} }
rb_str_buf_cat(buffer, p, bytesToWrite); rb_str_buf_cat(buffer, p, bytesToWrite);
} }
free(tmp); ruby_xfree(tmp);
source += 5 + (n - 1) * 6; source += 5 + (n - 1) * 6;
return source; return source;
} }