summaryrefslogtreecommitdiff
path: root/ext/json/parser/parser.rl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-18 06:18:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-18 06:18:37 +0000
commit6583e5dbfacf0bb6052c8d9b5cfccb2ab0df4e81 (patch)
tree65f667dca628f5973c4e1b63dd1d58143a33b455 /ext/json/parser/parser.rl
parentc35aa93590ff9737ffe14acf2218fc2085798426 (diff)
parser.rl: use StringValue
* ext/json/parser/parser.rl (cParser_initialize): use StringValue instead of direct rb_convert_type and remove duplicate conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json/parser/parser.rl')
-rw-r--r--ext/json/parser/parser.rl5
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl
index b9b51aaa4b..8ec3699b88 100644
--- a/ext/json/parser/parser.rl
+++ b/ext/json/parser/parser.rl
@@ -700,12 +700,11 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
json->object_class = Qnil;
json->array_class = Qnil;
}
- source = rb_convert_type(source, T_STRING, "String", "to_str");
+ StringValue(source);
if (!json->quirks_mode) {
- source = convert_encoding(StringValue(source));
+ source = convert_encoding(source);
}
json->current_nesting = 0;
- StringValue(source);
json->len = RSTRING_LEN(source);
json->source = RSTRING_PTR(source);;
json->Vsource = source;