[前][次][番号順一覧][スレッド一覧]

ruby-changes:39856

From: nobu <ko1@a...>
Date: Fri, 25 Sep 2015 17:09:45 +0900 (JST)
Subject: [ruby-changes:39856] nobu:r51937 (trunk): parser.c: update

nobu	2015-09-25 17:08:58 +0900 (Fri, 25 Sep 2015)

  New Revision: 51937

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51937

  Log:
    parser.c: update
    
    * ext/json/parser/parser.c: update to r51946.

  Modified files:
    trunk/ext/json/parser/parser.c
Index: ext/json/parser/parser.c
===================================================================
--- ext/json/parser/parser.c	(revision 51936)
+++ ext/json/parser/parser.c	(revision 51937)
@@ -1586,7 +1586,7 @@ case 7: https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1586
 
 static VALUE convert_encoding(VALUE source)
 {
-    char *ptr = RSTRING_PTR(source);
+    const char *ptr = RSTRING_PTR(source);
     long len = RSTRING_LEN(source);
     if (len < 2) {
         rb_raise(eParserError, "A JSON text must at least contain two octets!");
@@ -1659,12 +1659,18 @@ static VALUE cParser_initialize(int argc https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1659
     if (json->Vsource) {
         rb_raise(rb_eTypeError, "already initialized instance");
     }
+#ifdef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
+    rb_scan_args(argc, argv, "1:", &source, &opts);
+#else
     rb_scan_args(argc, argv, "11", &source, &opts);
+#endif
     if (!NIL_P(opts)) {
+#ifndef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
         opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash");
         if (NIL_P(opts)) {
             rb_raise(rb_eArgError, "opts needs to be like a hash");
         } else {
+#endif
             VALUE tmp = ID2SYM(i_max_nesting);
             if (option_given_p(opts, tmp)) {
                 VALUE max_nesting = rb_hash_aref(opts, tmp);
@@ -1727,7 +1733,9 @@ static VALUE cParser_initialize(int argc https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1733
             } else {
                 json->match_string = Qnil;
             }
+#ifndef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
         }
+#endif
     } else {
         json->max_nesting = 100;
         json->allow_nan = 0;
@@ -1748,7 +1756,7 @@ static VALUE cParser_initialize(int argc https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1756
 }
 
 
-#line 1752 "parser.c"
+#line 1760 "parser.c"
 enum {JSON_start = 1};
 enum {JSON_first_final = 10};
 enum {JSON_error = 0};
@@ -1756,7 +1764,7 @@ enum {JSON_error = 0}; https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1764
 enum {JSON_en_main = 1};
 
 
-#line 759 "parser.rl"
+#line 767 "parser.rl"
 
 
 static VALUE cParser_parse_strict(VALUE self)
@@ -1767,16 +1775,16 @@ static VALUE cParser_parse_strict(VALUE https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1775
     GET_PARSER;
 
 
-#line 1771 "parser.c"
+#line 1779 "parser.c"
 	{
 	cs = JSON_start;
 	}
 
-#line 769 "parser.rl"
+#line 777 "parser.rl"
     p = json->source;
     pe = p + json->len;
 
-#line 1780 "parser.c"
+#line 1788 "parser.c"
 	{
 	if ( p == pe )
 		goto _test_eof;
@@ -1832,7 +1840,7 @@ case 5: https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1840
 		goto st1;
 	goto st5;
 tr3:
-#line 748 "parser.rl"
+#line 756 "parser.rl"
 	{
         char *np;
         json->current_nesting = 1;
@@ -1841,7 +1849,7 @@ tr3: https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1849
     }
 	goto st10;
 tr4:
-#line 741 "parser.rl"
+#line 749 "parser.rl"
 	{
         char *np;
         json->current_nesting = 1;
@@ -1853,7 +1861,7 @@ st10: https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1861
 	if ( ++p == pe )
 		goto _test_eof10;
 case 10:
-#line 1857 "parser.c"
+#line 1865 "parser.c"
 	switch( (*p) ) {
 		case 13: goto st10;
 		case 32: goto st10;
@@ -1910,7 +1918,7 @@ case 9: https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1918
 	_out: {}
 	}
 
-#line 772 "parser.rl"
+#line 780 "parser.rl"
 
     if (cs >= JSON_first_final && p == pe) {
         return result;
@@ -1922,7 +1930,7 @@ case 9: https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1930
 
 
 
-#line 1926 "parser.c"
+#line 1934 "parser.c"
 enum {JSON_quirks_mode_start = 1};
 enum {JSON_quirks_mode_first_final = 10};
 enum {JSON_quirks_mode_error = 0};
@@ -1930,7 +1938,7 @@ enum {JSON_quirks_mode_error = 0}; https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1938
 enum {JSON_quirks_mode_en_main = 1};
 
 
-#line 797 "parser.rl"
+#line 805 "parser.rl"
 
 
 static VALUE cParser_parse_quirks_mode(VALUE self)
@@ -1941,16 +1949,16 @@ static VALUE cParser_parse_quirks_mode(V https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1949
     GET_PARSER;
 
 
-#line 1945 "parser.c"
+#line 1953 "parser.c"
 	{
 	cs = JSON_quirks_mode_start;
 	}
 
-#line 807 "parser.rl"
+#line 815 "parser.rl"
     p = json->source;
     pe = p + json->len;
 
-#line 1954 "parser.c"
+#line 1962 "parser.c"
 	{
 	if ( p == pe )
 		goto _test_eof;
@@ -1984,7 +1992,7 @@ st0: https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L1992
 cs = 0;
 	goto _out;
 tr2:
-#line 789 "parser.rl"
+#line 797 "parser.rl"
 	{
         char *np = JSON_parse_value(json, p, pe, &result);
         if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -1994,7 +2002,7 @@ st10: https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L2002
 	if ( ++p == pe )
 		goto _test_eof10;
 case 10:
-#line 1998 "parser.c"
+#line 2006 "parser.c"
 	switch( (*p) ) {
 		case 13: goto st10;
 		case 32: goto st10;
@@ -2083,7 +2091,7 @@ case 9: https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L2091
 	_out: {}
 	}
 
-#line 810 "parser.rl"
+#line 818 "parser.rl"
 
     if (cs >= JSON_quirks_mode_first_final && p == pe) {
         return result;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]