aboutsummaryrefslogtreecommitdiffstats
path: root/ext/json/parser/parser.rl
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2019-04-29 15:56:14 +0200
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-14 19:54:48 +0900
commit7376d70cb0817158a9ce0ef433872be5ca7af56b (patch)
treea1ec236cda4f6ae63185254f4382ff8b308a1f0f /ext/json/parser/parser.rl
parentede1a3dc110d3cfc094ce4cd5b27f92cab8b7b6c (diff)
downloadruby-7376d70cb0817158a9ce0ef433872be5ca7af56b.tar.gz
[flori/json] Only attempt to resize strings not other objects
https://github.com/flori/json/commit/167ada8da7
Diffstat (limited to 'ext/json/parser/parser.rl')
-rw-r--r--ext/json/parser/parser.rl6
1 files changed, 2 insertions, 4 deletions
diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl
index e634f44b80..6b38bb283a 100644
--- a/ext/json/parser/parser.rl
+++ b/ext/json/parser/parser.rl
@@ -571,10 +571,8 @@ 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 {
- if (RB_TYPE_P(*result, T_STRING)) {
- rb_str_resize(*result, RSTRING_LEN(*result));
- }
+ } else if (RB_TYPE_P(*result, T_STRING)) {
+ rb_str_resize(*result, RSTRING_LEN(*result));
}
if (cs >= JSON_string_first_final) {
return p + 1;