From e78ee8ff8d74b7a28f2248a754605a52c6edea80 Mon Sep 17 00:00:00 2001 From: Michael Mair-Keimberger Date: Sat, 9 Nov 2019 19:36:37 +0100 Subject: dev-ruby/json: remove unused patches Signed-off-by: Michael Mair-Keimberger Signed-off-by: Aaron Bauman --- dev-ruby/json/files/json-2.1.0-ruby26-1.patch | 20 ---- dev-ruby/json/files/json-2.1.0-ruby26-2.patch | 105 ------------------- dev-ruby/json/files/json-2.1.0-ruby26-3.patch | 143 -------------------------- 3 files changed, 268 deletions(-) delete mode 100644 dev-ruby/json/files/json-2.1.0-ruby26-1.patch delete mode 100644 dev-ruby/json/files/json-2.1.0-ruby26-2.patch delete mode 100644 dev-ruby/json/files/json-2.1.0-ruby26-3.patch diff --git a/dev-ruby/json/files/json-2.1.0-ruby26-1.patch b/dev-ruby/json/files/json-2.1.0-ruby26-1.patch deleted file mode 100644 index e6f76a4be141..000000000000 --- a/dev-ruby/json/files/json-2.1.0-ruby26-1.patch +++ /dev/null @@ -1,20 +0,0 @@ -commit bf226a9ac40e2296589004be89b4420b2121e000 -Author: eregon -Date: Fri Aug 3 15:11:22 2018 +0000 - - 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 - -diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl -index 29900a4a4a..fba01ac0e5 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"); diff --git a/dev-ruby/json/files/json-2.1.0-ruby26-2.patch b/dev-ruby/json/files/json-2.1.0-ruby26-2.patch deleted file mode 100644 index 9f1bff9b691e..000000000000 --- a/dev-ruby/json/files/json-2.1.0-ruby26-2.patch +++ /dev/null @@ -1,105 +0,0 @@ -commit e7da0fc34e8ed7fa250fc38f1109e4944cbad808 -Author: eregon -Date: Fri Aug 3 15:11:36 2018 +0000 - - 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 - -diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c -index b5ed093c1f..c8012796a4 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 @@ st0: - 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 @@ st10: - 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/parser/parser.rl b/ext/json/parser/parser.rl -index fba01ac0e5..edab32b78f 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; diff --git a/dev-ruby/json/files/json-2.1.0-ruby26-3.patch b/dev-ruby/json/files/json-2.1.0-ruby26-3.patch deleted file mode 100644 index cf16e235216c..000000000000 --- a/dev-ruby/json/files/json-2.1.0-ruby26-3.patch +++ /dev/null @@ -1,143 +0,0 @@ -commit a7e3516ff1116a15b3ed62f55143eceee27c4ce9 -Author: mrkn -Date: Sun Dec 2 05:21:57 2018 +0000 - - Fix JSON::Parser against bigdecimal updates - - git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e - -diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c -index c8012796a4..b02aae8fb9 100644 ---- a/ext/json/ext/parser/parser.c -+++ b/ext/json/ext/parser/parser.c -@@ -91,12 +91,13 @@ static int convert_UTF32_to_UTF8(char *buf, UTF32 ch) - - static VALUE mJSON, mExt, cParser, eParserError, eNestingError; - static VALUE CNaN, CInfinity, CMinusInfinity; -+static VALUE cBigDecimal = Qundef; - - static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions, - i_chr, i_max_nesting, i_allow_nan, i_symbolize_names, - i_object_class, i_array_class, i_decimal_class, i_key_p, - i_deep_const_get, i_match, i_match_string, i_aset, i_aref, -- i_leftshift, i_new; -+ i_leftshift, i_new, i_BigDecimal; - - - #line 125 "parser.rl" -@@ -985,6 +986,19 @@ enum {JSON_float_en_main = 1}; - #line 340 "parser.rl" - - -+static int is_bigdecimal_class(VALUE obj) -+{ -+ if (cBigDecimal == Qundef) { -+ if (rb_const_defined(rb_cObject, i_BigDecimal)) { -+ cBigDecimal = rb_const_get_at(rb_cObject, i_BigDecimal); -+ } -+ else { -+ return 0; -+ } -+ } -+ return obj == cBigDecimal; -+} -+ - static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result) - { - int cs = EVIL; -@@ -1136,7 +1150,11 @@ case 7: - } else { - VALUE text; - text = rb_str_new2(FBUFFER_PTR(json->fbuffer)); -- *result = rb_funcall(json->decimal_class, i_new, 1, text); -+ if (is_bigdecimal_class(json->decimal_class)) { -+ *result = rb_funcall(Qnil, i_BigDecimal, 1, text); -+ } else { -+ *result = rb_funcall(json->decimal_class, i_new, 1, text); -+ } - } - return p + 1; - } else { -@@ -2101,6 +2119,7 @@ void Init_parser(void) - i_aref = rb_intern("[]"); - i_leftshift = rb_intern("<<"); - i_new = rb_intern("new"); -+ i_BigDecimal = rb_intern("BigDecimal"); - } - - /* -diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl -index edab32b78f..d4e7a60e9d 100644 ---- a/ext/json/ext/parser/parser.rl -+++ b/ext/json/ext/parser/parser.rl -@@ -89,12 +89,13 @@ static int convert_UTF32_to_UTF8(char *buf, UTF32 ch) - - static VALUE mJSON, mExt, cParser, eParserError, eNestingError; - static VALUE CNaN, CInfinity, CMinusInfinity; -+static VALUE cBigDecimal = Qundef; - - static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions, - i_chr, i_max_nesting, i_allow_nan, i_symbolize_names, - i_object_class, i_array_class, i_decimal_class, i_key_p, - i_deep_const_get, i_match, i_match_string, i_aset, i_aref, -- i_leftshift, i_new; -+ i_leftshift, i_new, i_BigDecimal; - - %%{ - machine JSON_common; -@@ -339,6 +340,19 @@ static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *res - ) (^[0-9Ee.\-]? @exit ); - }%% - -+static int is_bigdecimal_class(VALUE obj) -+{ -+ if (cBigDecimal == Qundef) { -+ if (rb_const_defined(rb_cObject, i_BigDecimal)) { -+ cBigDecimal = rb_const_get_at(rb_cObject, i_BigDecimal); -+ } -+ else { -+ return 0; -+ } -+ } -+ return obj == cBigDecimal; -+} -+ - static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result) - { - int cs = EVIL; -@@ -357,7 +371,11 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul - } else { - VALUE text; - text = rb_str_new2(FBUFFER_PTR(json->fbuffer)); -- *result = rb_funcall(json->decimal_class, i_new, 1, text); -+ if (is_bigdecimal_class(json->decimal_class)) { -+ *result = rb_funcall(Qnil, i_BigDecimal, 1, text); -+ } else { -+ *result = rb_funcall(json->decimal_class, i_new, 1, text); -+ } - } - return p + 1; - } else { -@@ -861,6 +879,7 @@ void Init_parser(void) - i_aref = rb_intern("[]"); - i_leftshift = rb_intern("<<"); - i_new = rb_intern("new"); -+ i_BigDecimal = rb_intern("BigDecimal"); - } - - /* -diff --git a/test/json/json_parser_test.rb b/test/json/json_parser_test.rb -index 5f454eb121..68aeb572bb 100644 ---- a/tests/json_parser_test.rb -+++ b/tests/json_parser_test.rb -@@ -110,8 +110,8 @@ def test_parse_numbers - end - - def test_parse_bigdecimals -- assert_equal(BigDecimal, JSON.parse('{"foo": 9.01234567890123456789}', decimal_class: BigDecimal)["foo"].class) -- assert_equal(BigDecimal.new("0.901234567890123456789E1"),JSON.parse('{"foo": 9.01234567890123456789}', decimal_class: BigDecimal)["foo"] ) -+ assert_equal(BigDecimal, JSON.parse('{"foo": 9.01234567890123456789}', decimal_class: BigDecimal)["foo"].class) -+ assert_equal(BigDecimal("0.901234567890123456789E1"),JSON.parse('{"foo": 9.01234567890123456789}', decimal_class: BigDecimal)["foo"] ) - end - - if Array.method_defined?(:permutation) -- cgit v1.2.3-18-g5258