| |
@@ -0,0 +1,132 @@
|
| |
+ From 78baad8e646180deb1d85da20da31398aa68cad4 Mon Sep 17 00:00:00 2001
|
| |
+ From: eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
|
| |
+ Date: Fri, 3 Aug 2018 15:11:22 +0000
|
| |
+ Subject: [PATCH 1/2] Fix missed update of parser source in r62429
|
| |
+
|
| |
+ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
| |
+ ---
|
| |
+ ext/json/ext/parser/parser.rl | 1 +
|
| |
+ 1 file changed, 1 insertion(+)
|
| |
+
|
| |
+ diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl
|
| |
+ index 29900a4..fba01ac 100644
|
| |
+ --- a/ext/json/ext/parser/parser.rl
|
| |
+ +++ b/ext/json/ext/parser/parser.rl
|
| |
+ @@ -824,6 +824,7 @@ static VALUE cParser_source(VALUE self)
|
| |
+
|
| |
+ void Init_parser(void)
|
| |
+ {
|
| |
+ +#undef rb_intern
|
| |
+ rb_require("json/common");
|
| |
+ mJSON = rb_define_module("JSON");
|
| |
+ mExt = rb_define_module_under(mJSON, "Ext");
|
| |
+
|
| |
+ From 033dd10ac202a94a74652ad93e77c68937cc7b8e Mon Sep 17 00:00:00 2001
|
| |
+ From: eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
|
| |
+ Date: Fri, 3 Aug 2018 15:11:36 +0000
|
| |
+ Subject: [PATCH 2/2] ext/json/parser/parser.c: do not call rb_str_resize() on
|
| |
+ Time object
|
| |
+
|
| |
+ * See https://github.com/flori/json/issues/342
|
| |
+
|
| |
+ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
| |
+ ---
|
| |
+ ext/json/ext/parser/parser.c | 20 +++++++++++---------
|
| |
+ ext/json/ext/parser/parser.rl | 4 +++-
|
| |
+ 2 files changed, 14 insertions(+), 10 deletions(-)
|
| |
+
|
| |
+ diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c
|
| |
+ index d2e4eb6..f41aac5 100644
|
| |
+ --- a/ext/json/ext/parser/parser.c
|
| |
+ +++ b/ext/json/ext/parser/parser.c
|
| |
+ @@ -1659,7 +1659,9 @@ case 7:
|
| |
+ if (json->symbolize_names && json->parsing_name) {
|
| |
+ *result = rb_str_intern(*result);
|
| |
+ } else {
|
| |
+ - rb_str_resize(*result, RSTRING_LEN(*result));
|
| |
+ + if (RB_TYPE_P(*result, T_STRING)) {
|
| |
+ + rb_str_resize(*result, RSTRING_LEN(*result));
|
| |
+ + }
|
| |
+ }
|
| |
+ if (cs >= JSON_string_first_final) {
|
| |
+ return p + 1;
|
| |
+ @@ -1830,7 +1832,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
| |
+ }
|
| |
+
|
| |
+
|
| |
+ -#line 1834 "parser.c"
|
| |
+ +#line 1836 "parser.c"
|
| |
+ enum {JSON_start = 1};
|
| |
+ enum {JSON_first_final = 10};
|
| |
+ enum {JSON_error = 0};
|
| |
+ @@ -1838,7 +1840,7 @@ enum {JSON_error = 0};
|
| |
+ enum {JSON_en_main = 1};
|
| |
+
|
| |
+
|
| |
+ -#line 742 "parser.rl"
|
| |
+ +#line 744 "parser.rl"
|
| |
+
|
| |
+
|
| |
+ /*
|
| |
+ @@ -1855,16 +1857,16 @@ static VALUE cParser_parse(VALUE self)
|
| |
+ GET_PARSER;
|
| |
+
|
| |
+
|
| |
+ -#line 1859 "parser.c"
|
| |
+ +#line 1861 "parser.c"
|
| |
+ {
|
| |
+ cs = JSON_start;
|
| |
+ }
|
| |
+
|
| |
+ -#line 758 "parser.rl"
|
| |
+ +#line 760 "parser.rl"
|
| |
+ p = json->source;
|
| |
+ pe = p + json->len;
|
| |
+
|
| |
+ -#line 1868 "parser.c"
|
| |
+ +#line 1870 "parser.c"
|
| |
+ {
|
| |
+ if ( p == pe )
|
| |
+ goto _test_eof;
|
| |
+ @@ -1898,7 +1900,7 @@ case 1:
|
| |
+ cs = 0;
|
| |
+ goto _out;
|
| |
+ tr2:
|
| |
+ -#line 734 "parser.rl"
|
| |
+ +#line 736 "parser.rl"
|
| |
+ {
|
| |
+ char *np = JSON_parse_value(json, p, pe, &result, 0);
|
| |
+ if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
| |
+ @@ -1908,7 +1910,7 @@ cs = 0;
|
| |
+ if ( ++p == pe )
|
| |
+ goto _test_eof10;
|
| |
+ case 10:
|
| |
+ -#line 1912 "parser.c"
|
| |
+ +#line 1914 "parser.c"
|
| |
+ switch( (*p) ) {
|
| |
+ case 13: goto st10;
|
| |
+ case 32: goto st10;
|
| |
+ @@ -1997,7 +1999,7 @@ case 9:
|
| |
+ _out: {}
|
| |
+ }
|
| |
+
|
| |
+ -#line 761 "parser.rl"
|
| |
+ +#line 763 "parser.rl"
|
| |
+
|
| |
+ 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 fba01ac..edab32b 100644
|
| |
+ --- a/ext/json/ext/parser/parser.rl
|
| |
+ +++ b/ext/json/ext/parser/parser.rl
|
| |
+ @@ -554,7 +554,9 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
| |
+ if (json->symbolize_names && json->parsing_name) {
|
| |
+ *result = rb_str_intern(*result);
|
| |
+ } else {
|
| |
+ - rb_str_resize(*result, RSTRING_LEN(*result));
|
| |
+ + if (RB_TYPE_P(*result, T_STRING)) {
|
| |
+ + rb_str_resize(*result, RSTRING_LEN(*result));
|
| |
+ + }
|
| |
+ }
|
| |
+ if (cs >= JSON_string_first_final) {
|
| |
+ return p + 1;
|
| |
https://github.com/flori/json/pull/359
also enhance .spec file.
Copr build with Ruby 2.6:
https://copr.fedorainfracloud.org/coprs/build/849179/