From 236d43ed1aaa2eeae346d2f6b2304c32b62b8823 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 24 Apr 2016 02:08:30 +0900 Subject: Optional hash in rb_scan_args Use ':' in rb_scan_args to get optional hash, which available since ruby 2.1. --- ext/json/ext/parser/parser.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index a99b73b..f3e2502 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -1810,11 +1810,15 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) } +<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c <<<<<<< 2e06c964fceb550203659db23971459bc9d35054 #line 1814 "parser.c" ======= #line 1801 "parser.c" >>>>>>> Exception encoding +======= +#line 1809 "parser.c" +>>>>>>> Optional hash in rb_scan_args enum {JSON_start = 1}; enum {JSON_first_final = 10}; enum {JSON_error = 0}; @@ -1822,11 +1826,15 @@ enum {JSON_error = 0}; enum {JSON_en_main = 1}; +<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c <<<<<<< 2e06c964fceb550203659db23971459bc9d35054 #line 722 "parser.rl" ======= #line 709 "parser.rl" >>>>>>> Exception encoding +======= +#line 717 "parser.rl" +>>>>>>> Optional hash in rb_scan_args /* @@ -1843,15 +1851,20 @@ static VALUE cParser_parse(VALUE self) GET_PARSER; +<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c <<<<<<< 2e06c964fceb550203659db23971459bc9d35054 #line 1839 "parser.c" ======= #line 1826 "parser.c" >>>>>>> Exception encoding +======= +#line 1834 "parser.c" +>>>>>>> Optional hash in rb_scan_args { cs = JSON_start; } +<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c <<<<<<< 2e06c964fceb550203659db23971459bc9d35054 #line 738 "parser.rl" p = json->source; @@ -1865,6 +1878,13 @@ static VALUE cParser_parse(VALUE self) #line 1835 "parser.c" >>>>>>> Exception encoding +======= +#line 733 "parser.rl" + p = json->source; + pe = p + json->len; + +#line 1843 "parser.c" +>>>>>>> Optional hash in rb_scan_args { if ( p == pe ) goto _test_eof; @@ -1898,11 +1918,15 @@ st0: cs = 0; goto _out; tr2: +<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c <<<<<<< 2e06c964fceb550203659db23971459bc9d35054 #line 714 "parser.rl" ======= #line 701 "parser.rl" >>>>>>> Exception encoding +======= +#line 709 "parser.rl" +>>>>>>> Optional hash in rb_scan_args { char *np = JSON_parse_value(json, p, pe, &result); if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;} @@ -1912,11 +1936,15 @@ st10: if ( ++p == pe ) goto _test_eof10; case 10: +<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c <<<<<<< 2e06c964fceb550203659db23971459bc9d35054 #line 1892 "parser.c" ======= #line 1879 "parser.c" >>>>>>> Exception encoding +======= +#line 1887 "parser.c" +>>>>>>> Optional hash in rb_scan_args switch( (*p) ) { case 13: goto st10; case 32: goto st10; @@ -2005,11 +2033,15 @@ case 9: _out: {} } +<<<<<<< 066bc5c70082f719951f398f4e20894571f8986c <<<<<<< 2e06c964fceb550203659db23971459bc9d35054 #line 741 "parser.rl" ======= #line 728 "parser.rl" >>>>>>> Exception encoding +======= +#line 736 "parser.rl" +>>>>>>> Optional hash in rb_scan_args if (cs >= JSON_first_final && p == pe) { return result; -- cgit v1.2.1