Skip to content

Commit 1915b9a

Browse files
committed
Remove most patches
PullRequest: truffleruby/521
2 parents ab4f2f8 + 100a51f commit 1915b9a

30 files changed

+130
-1402
lines changed

lib/cext/patches/common_patches.rb

Lines changed: 0 additions & 78 deletions
This file was deleted.

lib/cext/patches/json_patches.rb

Lines changed: 1 addition & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -6,112 +6,18 @@
66
# GNU General Public License version 2, or
77
# GNU Lesser General Public License version 2.1.
88

9-
require_relative 'common_patches'
10-
11-
class JsonPatches < CommonPatches
9+
class JsonPatches
1210
PATCHES = {
1311
gem: 'json',
1412
patches: {
1513
['parser', 'parser.c'] => [
16-
*read_write_field('json','Vsource', false),
17-
*read_write_field('json','create_id', false),
18-
*read_write_field('json','object_class', false),
19-
*read_write_field('json','array_class', false),
20-
*read_write_field('json','decimal_class', false),
21-
*read_write_field('json','match_string', false),
22-
{ # cParser_initialize
23-
match: /if \(rb_tr_managed_from_handle\(json->Vsource\)\)/,
24-
replacement: 'if (json->Vsource)'
25-
},
26-
{ # cParser_parse
27-
match: /VALUE result = Qnil;/,
28-
replacement: "VALUE result_array_for_address[1];\nresult_array_for_address[0] = Qnil;"
29-
},
30-
{ # cParser_parse
31-
match: /char \*np = JSON_parse_value\(json, p, pe, &result, 0\);/,
32-
replacement: 'char *np = JSON_parse_value(json, p, pe, result_array_for_address, 0);'
33-
},
34-
{
35-
match: /if \(cs >= JSON_first_final && p == pe\) {\s+return result;/m,
36-
replacement: "if (cs >= JSON_first_final && p == pe) {\n return result_array_for_address[0];"
37-
},
38-
{ # JSON_parse_object
39-
match: /VALUE last_name = Qnil;/,
40-
replacement: "VALUE last_name_array_for_address[1];\nlast_name_array_for_address[0] = Qnil;"
41-
},
42-
{ # JSON_parse_object
43-
match: /VALUE v = Qnil;/,
44-
replacement: "VALUE v_array_for_address[1];\nv_array_for_address[0] = Qnil;"
45-
},
46-
{ # JSON_parse_object
47-
match: /np = JSON_parse_string\(json, p, pe, &last_name\);/,
48-
replacement: 'np = JSON_parse_string(json, p, pe, last_name_array_for_address);'
49-
},
50-
{ # JSON_parse_object
51-
match: /rb_hash_aset\(\*result, last_name, v\);/,
52-
replacement: 'rb_hash_aset(*result, last_name_array_for_address[0], v_array_for_address[0]);'
53-
},
54-
{ # JSON_parse_object
55-
match: /rb_funcall\(\*result, i_aset, 2, last_name, v\);/,
56-
replacement: 'rb_funcall(*result, i_aset, 2, last_name_array_for_address[0], v_array_for_address[0]);'
57-
},
58-
{ # JSON_parse_object
59-
match: /char \*np = JSON_parse_value\(json, p, pe, &v, current_nesting\);/,
60-
replacement: 'char *np = JSON_parse_value(json, p, pe, v_array_for_address, current_nesting);'
61-
},
62-
{ # JSON_parse_object
63-
match: /rb_ary_push\(\*result, v\);/,
64-
replacement: 'rb_ary_push(*result, v_array_for_address[0]);'
65-
},
66-
{ # JSON_parse_object
67-
match: /rb_funcall\(\*result, i_leftshift, 1, v\);/,
68-
replacement: 'rb_funcall(*result, i_leftshift, 1, v_array_for_address[0]);'
69-
},
70-
{ # JSON_parse_object
71-
match: /char \*np = JSON_parse_value\(json, p, pe, &v\);/,
72-
replacement: 'char *np = JSON_parse_value(json, p, pe, v_array_for_address);'
73-
},
74-
{ # JSON_parse_string
75-
match: /if \(json->create_additions && RTEST\(match_string = rb_tr_managed_from_handle\(json->match_string\)\)\) {/,
76-
replacement: 'if (json->create_additions && RTEST(match_string = rb_tr_managed_from_handle_or_null(json->match_string))) {'
77-
},
7814
{ # JSON_parse_string
7915
# Work around a bug in the json extension where it tries to call `rb_str_resize` on non-String objects.
8016
# We remove it entirely because the string resize is an MRI-optimization to reduce large preallocated strings
8117
# to embedded strings. We don't have that distinction in our implementation and the resize would be a wasteful operation.
8218
match: /rb_str_resize\(\*result, RSTRING_LEN\(\*result\)\);/,
8319
replacement: ''
8420
},
85-
{ # cParser_parse_strict
86-
match: /np = JSON_parse_array\(json, p, pe, &result\);/,
87-
replacement: 'np = JSON_parse_array(json, p, pe, result_array_for_address);'
88-
},
89-
{ # cParser_parse_strict
90-
match: /np = JSON_parse_object\(json, p, pe, &result\);/,
91-
replacement: 'np = JSON_parse_object(json, p, pe, result_array_for_address);'
92-
},
93-
{ # cParser_parse_quirks_mode
94-
match: /if \(cs >= JSON_quirks_mode_first_final && p == pe\) {\s+return result;/m,
95-
replacement: "if (cs >= JSON_quirks_mode_first_final && p == pe) {\n return result_array_for_address[0];"
96-
},
97-
{ # cParser_parse_quirks_mode
98-
match: /char \*np = JSON_parse_value\(json, p, pe, &result\);/,
99-
replacement: 'char *np = JSON_parse_value(json, p, pe, result_array_for_address);'
100-
}
101-
],
102-
['generator', 'generator.c'] => [
103-
{ # generate_json
104-
match: /if \(obj == Qnil\)/,
105-
replacement: 'if (NIL_P(obj))'
106-
},
107-
{ # generate_json
108-
match: /if \(obj == Qfalse\)/,
109-
replacement: 'if (rb_tr_obj_equal(Qfalse, obj))'
110-
},
111-
{ # generate_json
112-
match: /if \(obj == Qtrue\)/,
113-
replacement: 'if (rb_tr_obj_equal(Qtrue, obj))'
114-
}
11521
]
11622
}
11723
}

lib/cext/patches/mysql2_patches.rb

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)