diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2016-04-24 01:37:39 +0900 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2016-06-21 10:56:58 +0200 |
commit | a20bc3c5fcd0e93b85803e685b527ac1ea14c1be (patch) | |
tree | ec19afac5b0d5e65e5dfe91df23eb0711572da1b /ext | |
parent | 963e815cb1c3c9989192b2459da9a93518522807 (diff) | |
download | json-a20bc3c5fcd0e93b85803e685b527ac1ea14c1be.tar.gz |
Remove unnecessary conversion
StringValue does the conversion.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/json/ext/parser/parser.c | 33 | ||||
-rw-r--r-- | ext/json/ext/parser/parser.rl | 1 |
2 files changed, 32 insertions, 2 deletions
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index b1260b3..afa2864 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -1842,7 +1842,6 @@ 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"); source = convert_encoding(StringValue(source)); json->current_nesting = 0; StringValue(source); @@ -1853,6 +1852,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) } +<<<<<<< 949543418c0888d7deba00a93e08b7f56637ce9b <<<<<<< dad1dad53ad48946bf2a8de60b8fb419e1180bf0 #line 1813 "parser.c" static const int JSON_start = 1; @@ -1860,6 +1860,9 @@ static const int JSON_first_final = 10; static const int JSON_error = 0; ======= #line 1788 "parser.c" +======= +#line 1787 "parser.c" +>>>>>>> Remove unnecessary conversion enum {JSON_start = 1}; enum {JSON_first_final = 10}; enum {JSON_error = 0}; @@ -1868,7 +1871,11 @@ enum {JSON_error = 0}; enum {JSON_en_main = 1}; +<<<<<<< 949543418c0888d7deba00a93e08b7f56637ce9b #line 721 "parser.rl" +======= +#line 695 "parser.rl" +>>>>>>> Remove unnecessary conversion /* @@ -1885,16 +1892,28 @@ static VALUE cParser_parse(VALUE self) GET_PARSER; +<<<<<<< 949543418c0888d7deba00a93e08b7f56637ce9b #line 1838 "parser.c" +======= +#line 1812 "parser.c" +>>>>>>> Remove unnecessary conversion { cs = JSON_start; } +<<<<<<< 949543418c0888d7deba00a93e08b7f56637ce9b #line 737 "parser.rl" p = json->source; pe = p + json->len; #line 1847 "parser.c" +======= +#line 711 "parser.rl" + p = json->source; + pe = p + json->len; + +#line 1821 "parser.c" +>>>>>>> Remove unnecessary conversion { if ( p == pe ) goto _test_eof; @@ -1928,7 +1947,11 @@ st0: cs = 0; goto _out; tr2: +<<<<<<< 949543418c0888d7deba00a93e08b7f56637ce9b #line 713 "parser.rl" +======= +#line 687 "parser.rl" +>>>>>>> Remove unnecessary conversion { char *np = JSON_parse_value(json, p, pe, &result); if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;} @@ -1938,7 +1961,11 @@ st10: if ( ++p == pe ) goto _test_eof10; case 10: +<<<<<<< 949543418c0888d7deba00a93e08b7f56637ce9b #line 1891 "parser.c" +======= +#line 1865 "parser.c" +>>>>>>> Remove unnecessary conversion switch( (*p) ) { case 13: goto st10; case 32: goto st10; @@ -2027,7 +2054,11 @@ case 9: _out: {} } +<<<<<<< 949543418c0888d7deba00a93e08b7f56637ce9b #line 740 "parser.rl" +======= +#line 714 "parser.rl" +>>>>>>> Remove unnecessary conversion if (cs >= JSON_first_final && p == pe) { return result; diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index f479281..0c65a09 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -695,7 +695,6 @@ 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"); source = convert_encoding(StringValue(source)); json->current_nesting = 0; StringValue(source); |