diff options
author | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2018-12-20 19:04:24 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-20 19:04:24 +0900 |
commit | 409f8f6995a5f9f805b2b604464a8ef032f71291 (patch) | |
tree | 1ba6a5e98d77f899e968a676288c25593f9314ee /ext/json/ext/parser/parser.rl | |
parent | 2f693d31bebe9d414e0857556a005272b41bcba0 (diff) | |
parent | 033dd10ac202a94a74652ad93e77c68937cc7b8e (diff) | |
download | json-409f8f6995a5f9f805b2b604464a8ef032f71291.tar.gz |
Merge pull request #359 from flori/pick-ruby-core
Backport from Ruby core repository
Diffstat (limited to 'ext/json/ext/parser/parser.rl')
-rw-r--r-- | ext/json/ext/parser/parser.rl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index 29900a4..edab32b 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -554,7 +554,9 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu if (json->symbolize_names && json->parsing_name) { *result = rb_str_intern(*result); } else { - rb_str_resize(*result, RSTRING_LEN(*result)); + if (RB_TYPE_P(*result, T_STRING)) { + rb_str_resize(*result, RSTRING_LEN(*result)); + } } if (cs >= JSON_string_first_final) { return p + 1; @@ -824,6 +826,7 @@ static VALUE cParser_source(VALUE self) void Init_parser(void) { +#undef rb_intern rb_require("json/common"); mJSON = rb_define_module("JSON"); mExt = rb_define_module_under(mJSON, "Ext"); |