diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-18 06:18:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-18 06:18:37 +0000 |
commit | 6583e5dbfacf0bb6052c8d9b5cfccb2ab0df4e81 (patch) | |
tree | 65f667dca628f5973c4e1b63dd1d58143a33b455 /ext/json/parser/parser.rl | |
parent | c35aa93590ff9737ffe14acf2218fc2085798426 (diff) | |
download | ruby-6583e5dbfacf0bb6052c8d9b5cfccb2ab0df4e81.tar.gz |
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.rl | 5 |
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; |