oj 3.11.5 → 3.16.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1421 -0
- data/README.md +19 -5
- data/RELEASE_NOTES.md +61 -0
- data/ext/oj/buf.h +20 -6
- data/ext/oj/cache.c +329 -0
- data/ext/oj/cache.h +22 -0
- data/ext/oj/cache8.c +10 -9
- data/ext/oj/circarray.c +8 -6
- data/ext/oj/circarray.h +2 -2
- data/ext/oj/code.c +19 -33
- data/ext/oj/code.h +2 -2
- data/ext/oj/compat.c +27 -77
- data/ext/oj/custom.c +86 -179
- data/ext/oj/debug.c +126 -0
- data/ext/oj/dump.c +256 -249
- data/ext/oj/dump.h +26 -12
- data/ext/oj/dump_compat.c +565 -642
- data/ext/oj/dump_leaf.c +17 -63
- data/ext/oj/dump_object.c +65 -187
- data/ext/oj/dump_strict.c +27 -51
- data/ext/oj/encoder.c +43 -0
- data/ext/oj/err.c +2 -13
- data/ext/oj/err.h +24 -8
- data/ext/oj/extconf.rb +21 -6
- data/ext/oj/fast.c +149 -149
- data/ext/oj/intern.c +313 -0
- data/ext/oj/intern.h +22 -0
- data/ext/oj/mem.c +318 -0
- data/ext/oj/mem.h +53 -0
- data/ext/oj/mimic_json.c +121 -106
- data/ext/oj/object.c +85 -162
- data/ext/oj/odd.c +89 -67
- data/ext/oj/odd.h +15 -15
- data/ext/oj/oj.c +542 -411
- data/ext/oj/oj.h +99 -73
- data/ext/oj/parse.c +175 -187
- data/ext/oj/parse.h +26 -24
- data/ext/oj/parser.c +1600 -0
- data/ext/oj/parser.h +101 -0
- data/ext/oj/rails.c +112 -159
- data/ext/oj/rails.h +1 -1
- data/ext/oj/reader.c +11 -14
- data/ext/oj/reader.h +4 -2
- data/ext/oj/resolve.c +5 -24
- data/ext/oj/rxclass.c +7 -6
- data/ext/oj/rxclass.h +1 -1
- data/ext/oj/saj.c +22 -33
- data/ext/oj/saj2.c +584 -0
- data/ext/oj/saj2.h +23 -0
- data/ext/oj/scp.c +5 -28
- data/ext/oj/sparse.c +28 -72
- data/ext/oj/stream_writer.c +50 -40
- data/ext/oj/strict.c +56 -61
- data/ext/oj/string_writer.c +72 -39
- data/ext/oj/trace.h +31 -4
- data/ext/oj/usual.c +1218 -0
- data/ext/oj/usual.h +69 -0
- data/ext/oj/util.h +1 -1
- data/ext/oj/val_stack.c +14 -3
- data/ext/oj/val_stack.h +8 -7
- data/ext/oj/validate.c +46 -0
- data/ext/oj/wab.c +63 -88
- data/lib/oj/active_support_helper.rb +1 -3
- data/lib/oj/bag.rb +7 -1
- data/lib/oj/easy_hash.rb +4 -5
- data/lib/oj/error.rb +1 -2
- data/lib/oj/json.rb +162 -150
- data/lib/oj/mimic.rb +9 -7
- data/lib/oj/saj.rb +20 -6
- data/lib/oj/schandler.rb +5 -4
- data/lib/oj/state.rb +12 -8
- data/lib/oj/version.rb +1 -2
- data/lib/oj.rb +2 -0
- data/pages/Compatibility.md +1 -1
- data/pages/InstallOptions.md +20 -0
- data/pages/JsonGem.md +15 -0
- data/pages/Modes.md +8 -3
- data/pages/Options.md +43 -5
- data/pages/Parser.md +309 -0
- data/pages/Rails.md +14 -2
- data/test/_test_active.rb +8 -9
- data/test/_test_active_mimic.rb +7 -8
- data/test/_test_mimic_rails.rb +17 -20
- data/test/activerecord/result_test.rb +5 -6
- data/test/activesupport6/encoding_test.rb +63 -28
- data/test/{activesupport5 → activesupport7}/abstract_unit.rb +16 -12
- data/test/{activesupport5 → activesupport7}/decoding_test.rb +2 -10
- data/test/{activesupport5 → activesupport7}/encoding_test.rb +86 -50
- data/test/{activesupport5 → activesupport7}/encoding_test_cases.rb +6 -0
- data/test/{activesupport5 → activesupport7}/time_zone_test_helpers.rb +8 -0
- data/test/files.rb +15 -15
- data/test/foo.rb +16 -45
- data/test/helper.rb +11 -8
- data/test/isolated/shared.rb +3 -2
- data/test/json_gem/json_addition_test.rb +2 -2
- data/test/json_gem/json_common_interface_test.rb +8 -6
- data/test/json_gem/json_encoding_test.rb +0 -0
- data/test/json_gem/json_ext_parser_test.rb +1 -0
- data/test/json_gem/json_fixtures_test.rb +3 -2
- data/test/json_gem/json_generator_test.rb +56 -38
- data/test/json_gem/json_generic_object_test.rb +11 -11
- data/test/json_gem/json_parser_test.rb +54 -47
- data/test/json_gem/json_string_matching_test.rb +9 -9
- data/test/json_gem/test_helper.rb +7 -3
- data/test/mem.rb +34 -0
- data/test/perf.rb +22 -27
- data/test/perf_compat.rb +31 -33
- data/test/perf_dump.rb +50 -0
- data/test/perf_fast.rb +80 -82
- data/test/perf_file.rb +27 -29
- data/test/perf_object.rb +65 -69
- data/test/perf_once.rb +59 -0
- data/test/perf_parser.rb +183 -0
- data/test/perf_saj.rb +46 -54
- data/test/perf_scp.rb +58 -69
- data/test/perf_simple.rb +41 -39
- data/test/perf_strict.rb +74 -82
- data/test/perf_wab.rb +67 -69
- data/test/prec.rb +5 -5
- data/test/sample/change.rb +0 -1
- data/test/sample/dir.rb +0 -1
- data/test/sample/doc.rb +0 -1
- data/test/sample/file.rb +0 -1
- data/test/sample/group.rb +0 -1
- data/test/sample/hasprops.rb +0 -1
- data/test/sample/layer.rb +0 -1
- data/test/sample/rect.rb +0 -1
- data/test/sample/shape.rb +0 -1
- data/test/sample/text.rb +0 -1
- data/test/sample.rb +16 -16
- data/test/sample_json.rb +8 -8
- data/test/test_compat.rb +95 -43
- data/test/test_custom.rb +73 -51
- data/test/test_debian.rb +7 -10
- data/test/test_fast.rb +135 -79
- data/test/test_file.rb +41 -30
- data/test/test_gc.rb +16 -5
- data/test/test_generate.rb +5 -5
- data/test/test_hash.rb +5 -5
- data/test/test_integer_range.rb +9 -9
- data/test/test_null.rb +20 -20
- data/test/test_object.rb +99 -96
- data/test/test_parser.rb +11 -0
- data/test/test_parser_debug.rb +27 -0
- data/test/test_parser_saj.rb +337 -0
- data/test/test_parser_usual.rb +251 -0
- data/test/test_rails.rb +2 -2
- data/test/test_saj.rb +10 -8
- data/test/test_scp.rb +37 -39
- data/test/test_strict.rb +40 -32
- data/test/test_various.rb +165 -84
- data/test/test_wab.rb +48 -44
- data/test/test_writer.rb +47 -47
- data/test/tests.rb +13 -5
- data/test/tests_mimic.rb +12 -3
- data/test/tests_mimic_addition.rb +12 -3
- metadata +74 -128
- data/ext/oj/hash.c +0 -131
- data/ext/oj/hash.h +0 -19
- data/ext/oj/hash_test.c +0 -491
- data/test/activesupport4/decoding_test.rb +0 -108
- data/test/activesupport4/encoding_test.rb +0 -531
- data/test/activesupport4/test_helper.rb +0 -41
- data/test/activesupport5/test_helper.rb +0 -72
- data/test/bar.rb +0 -35
- data/test/baz.rb +0 -16
- data/test/zoo.rb +0 -13
metadata
CHANGED
@@ -1,35 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.16.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bigdecimal
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '2.0'
|
23
|
-
type: :development
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0
|
30
|
-
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ostruct
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version: '2
|
33
|
+
version: '0.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.2'
|
33
41
|
- !ruby/object:Gem::Dependency
|
34
42
|
name: minitest
|
35
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,33 +53,39 @@ dependencies:
|
|
45
53
|
- !ruby/object:Gem::Version
|
46
54
|
version: '5'
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
56
|
+
name: rake-compiler
|
49
57
|
requirement: !ruby/object:Gem::Requirement
|
50
58
|
requirements:
|
51
|
-
- - "
|
59
|
+
- - ">="
|
52
60
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
61
|
+
version: '0.9'
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '2.0'
|
54
65
|
type: :development
|
55
66
|
prerelease: false
|
56
67
|
version_requirements: !ruby/object:Gem::Requirement
|
57
68
|
requirements:
|
58
|
-
- - "
|
69
|
+
- - ">="
|
59
70
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
71
|
+
version: '0.9'
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '2.0'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
76
|
+
name: test-unit
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
64
78
|
requirements:
|
65
79
|
- - "~>"
|
66
80
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0'
|
81
|
+
version: '3.0'
|
68
82
|
type: :development
|
69
83
|
prerelease: false
|
70
84
|
version_requirements: !ruby/object:Gem::Requirement
|
71
85
|
requirements:
|
72
86
|
- - "~>"
|
73
87
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0'
|
88
|
+
version: '3.0'
|
75
89
|
description: The fastest JSON parser and object serializer.
|
76
90
|
email: peter@ohler.com
|
77
91
|
executables: []
|
@@ -79,20 +93,29 @@ extensions:
|
|
79
93
|
- ext/oj/extconf.rb
|
80
94
|
extra_rdoc_files:
|
81
95
|
- README.md
|
96
|
+
- LICENSE
|
97
|
+
- CHANGELOG.md
|
98
|
+
- RELEASE_NOTES.md
|
82
99
|
- pages/Advanced.md
|
83
100
|
- pages/Compatibility.md
|
84
101
|
- pages/Custom.md
|
85
102
|
- pages/Encoding.md
|
103
|
+
- pages/InstallOptions.md
|
86
104
|
- pages/JsonGem.md
|
87
105
|
- pages/Modes.md
|
88
106
|
- pages/Options.md
|
107
|
+
- pages/Parser.md
|
89
108
|
- pages/Rails.md
|
90
109
|
- pages/Security.md
|
91
110
|
- pages/WAB.md
|
92
111
|
files:
|
112
|
+
- CHANGELOG.md
|
93
113
|
- LICENSE
|
94
114
|
- README.md
|
115
|
+
- RELEASE_NOTES.md
|
95
116
|
- ext/oj/buf.h
|
117
|
+
- ext/oj/cache.c
|
118
|
+
- ext/oj/cache.h
|
96
119
|
- ext/oj/cache8.c
|
97
120
|
- ext/oj/cache8.h
|
98
121
|
- ext/oj/circarray.c
|
@@ -101,6 +124,7 @@ files:
|
|
101
124
|
- ext/oj/code.h
|
102
125
|
- ext/oj/compat.c
|
103
126
|
- ext/oj/custom.c
|
127
|
+
- ext/oj/debug.c
|
104
128
|
- ext/oj/dump.c
|
105
129
|
- ext/oj/dump.h
|
106
130
|
- ext/oj/dump_compat.c
|
@@ -108,13 +132,15 @@ files:
|
|
108
132
|
- ext/oj/dump_object.c
|
109
133
|
- ext/oj/dump_strict.c
|
110
134
|
- ext/oj/encode.h
|
135
|
+
- ext/oj/encoder.c
|
111
136
|
- ext/oj/err.c
|
112
137
|
- ext/oj/err.h
|
113
138
|
- ext/oj/extconf.rb
|
114
139
|
- ext/oj/fast.c
|
115
|
-
- ext/oj/
|
116
|
-
- ext/oj/
|
117
|
-
- ext/oj/
|
140
|
+
- ext/oj/intern.c
|
141
|
+
- ext/oj/intern.h
|
142
|
+
- ext/oj/mem.c
|
143
|
+
- ext/oj/mem.h
|
118
144
|
- ext/oj/mimic_json.c
|
119
145
|
- ext/oj/object.c
|
120
146
|
- ext/oj/odd.c
|
@@ -123,6 +149,8 @@ files:
|
|
123
149
|
- ext/oj/oj.h
|
124
150
|
- ext/oj/parse.c
|
125
151
|
- ext/oj/parse.h
|
152
|
+
- ext/oj/parser.c
|
153
|
+
- ext/oj/parser.h
|
126
154
|
- ext/oj/rails.c
|
127
155
|
- ext/oj/rails.h
|
128
156
|
- ext/oj/reader.c
|
@@ -132,6 +160,8 @@ files:
|
|
132
160
|
- ext/oj/rxclass.c
|
133
161
|
- ext/oj/rxclass.h
|
134
162
|
- ext/oj/saj.c
|
163
|
+
- ext/oj/saj2.c
|
164
|
+
- ext/oj/saj2.h
|
135
165
|
- ext/oj/scp.c
|
136
166
|
- ext/oj/sparse.c
|
137
167
|
- ext/oj/stream_writer.c
|
@@ -139,10 +169,13 @@ files:
|
|
139
169
|
- ext/oj/string_writer.c
|
140
170
|
- ext/oj/trace.c
|
141
171
|
- ext/oj/trace.h
|
172
|
+
- ext/oj/usual.c
|
173
|
+
- ext/oj/usual.h
|
142
174
|
- ext/oj/util.c
|
143
175
|
- ext/oj/util.h
|
144
176
|
- ext/oj/val_stack.c
|
145
177
|
- ext/oj/val_stack.h
|
178
|
+
- ext/oj/validate.c
|
146
179
|
- ext/oj/wab.c
|
147
180
|
- lib/oj.rb
|
148
181
|
- lib/oj/active_support_helper.rb
|
@@ -159,9 +192,11 @@ files:
|
|
159
192
|
- pages/Compatibility.md
|
160
193
|
- pages/Custom.md
|
161
194
|
- pages/Encoding.md
|
195
|
+
- pages/InstallOptions.md
|
162
196
|
- pages/JsonGem.md
|
163
197
|
- pages/Modes.md
|
164
198
|
- pages/Options.md
|
199
|
+
- pages/Parser.md
|
165
200
|
- pages/Rails.md
|
166
201
|
- pages/Security.md
|
167
202
|
- pages/WAB.md
|
@@ -169,15 +204,6 @@ files:
|
|
169
204
|
- test/_test_active_mimic.rb
|
170
205
|
- test/_test_mimic_rails.rb
|
171
206
|
- test/activerecord/result_test.rb
|
172
|
-
- test/activesupport4/decoding_test.rb
|
173
|
-
- test/activesupport4/encoding_test.rb
|
174
|
-
- test/activesupport4/test_helper.rb
|
175
|
-
- test/activesupport5/abstract_unit.rb
|
176
|
-
- test/activesupport5/decoding_test.rb
|
177
|
-
- test/activesupport5/encoding_test.rb
|
178
|
-
- test/activesupport5/encoding_test_cases.rb
|
179
|
-
- test/activesupport5/test_helper.rb
|
180
|
-
- test/activesupport5/time_zone_test_helpers.rb
|
181
207
|
- test/activesupport6/abstract_unit.rb
|
182
208
|
- test/activesupport6/decoding_test.rb
|
183
209
|
- test/activesupport6/encoding_test.rb
|
@@ -185,8 +211,11 @@ files:
|
|
185
211
|
- test/activesupport6/test_common.rb
|
186
212
|
- test/activesupport6/test_helper.rb
|
187
213
|
- test/activesupport6/time_zone_test_helpers.rb
|
188
|
-
- test/
|
189
|
-
- test/
|
214
|
+
- test/activesupport7/abstract_unit.rb
|
215
|
+
- test/activesupport7/decoding_test.rb
|
216
|
+
- test/activesupport7/encoding_test.rb
|
217
|
+
- test/activesupport7/encoding_test_cases.rb
|
218
|
+
- test/activesupport7/time_zone_test_helpers.rb
|
190
219
|
- test/files.rb
|
191
220
|
- test/foo.rb
|
192
221
|
- test/helper.rb
|
@@ -209,11 +238,15 @@ files:
|
|
209
238
|
- test/json_gem/json_parser_test.rb
|
210
239
|
- test/json_gem/json_string_matching_test.rb
|
211
240
|
- test/json_gem/test_helper.rb
|
241
|
+
- test/mem.rb
|
212
242
|
- test/perf.rb
|
213
243
|
- test/perf_compat.rb
|
244
|
+
- test/perf_dump.rb
|
214
245
|
- test/perf_fast.rb
|
215
246
|
- test/perf_file.rb
|
216
247
|
- test/perf_object.rb
|
248
|
+
- test/perf_once.rb
|
249
|
+
- test/perf_parser.rb
|
217
250
|
- test/perf_saj.rb
|
218
251
|
- test/perf_scp.rb
|
219
252
|
- test/perf_simple.rb
|
@@ -245,6 +278,10 @@ files:
|
|
245
278
|
- test/test_integer_range.rb
|
246
279
|
- test/test_null.rb
|
247
280
|
- test/test_object.rb
|
281
|
+
- test/test_parser.rb
|
282
|
+
- test/test_parser_debug.rb
|
283
|
+
- test/test_parser_saj.rb
|
284
|
+
- test/test_parser_usual.rb
|
248
285
|
- test/test_rails.rb
|
249
286
|
- test/test_saj.rb
|
250
287
|
- test/test_scp.rb
|
@@ -255,7 +292,6 @@ files:
|
|
255
292
|
- test/tests.rb
|
256
293
|
- test/tests_mimic.rb
|
257
294
|
- test/tests_mimic_addition.rb
|
258
|
-
- test/zoo.rb
|
259
295
|
homepage: http://www.ohler.com/oj
|
260
296
|
licenses:
|
261
297
|
- MIT
|
@@ -266,6 +302,7 @@ metadata:
|
|
266
302
|
homepage_uri: http://www.ohler.com/oj/
|
267
303
|
source_code_uri: https://github.com/ohler55/oj
|
268
304
|
wiki_uri: https://github.com/ohler55/oj/wiki
|
305
|
+
rubygems_mfa_required: 'true'
|
269
306
|
post_install_message:
|
270
307
|
rdoc_options:
|
271
308
|
- "--title"
|
@@ -278,106 +315,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
278
315
|
requirements:
|
279
316
|
- - ">="
|
280
317
|
- !ruby/object:Gem::Version
|
281
|
-
version: '2.
|
318
|
+
version: '2.7'
|
282
319
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
283
320
|
requirements:
|
284
321
|
- - ">="
|
285
322
|
- !ruby/object:Gem::Version
|
286
323
|
version: '0'
|
287
324
|
requirements: []
|
288
|
-
rubygems_version: 3.
|
325
|
+
rubygems_version: 3.4.10
|
289
326
|
signing_key:
|
290
327
|
specification_version: 4
|
291
328
|
summary: A fast JSON parser and serializer.
|
292
|
-
test_files:
|
293
|
-
- test/_test_active.rb
|
294
|
-
- test/_test_active_mimic.rb
|
295
|
-
- test/_test_mimic_rails.rb
|
296
|
-
- test/activerecord/result_test.rb
|
297
|
-
- test/activesupport4/decoding_test.rb
|
298
|
-
- test/activesupport4/encoding_test.rb
|
299
|
-
- test/activesupport4/test_helper.rb
|
300
|
-
- test/activesupport5/abstract_unit.rb
|
301
|
-
- test/activesupport5/decoding_test.rb
|
302
|
-
- test/activesupport5/encoding_test.rb
|
303
|
-
- test/activesupport5/encoding_test_cases.rb
|
304
|
-
- test/activesupport5/test_helper.rb
|
305
|
-
- test/activesupport5/time_zone_test_helpers.rb
|
306
|
-
- test/activesupport6/abstract_unit.rb
|
307
|
-
- test/activesupport6/decoding_test.rb
|
308
|
-
- test/activesupport6/encoding_test.rb
|
309
|
-
- test/activesupport6/encoding_test_cases.rb
|
310
|
-
- test/activesupport6/test_common.rb
|
311
|
-
- test/activesupport6/test_helper.rb
|
312
|
-
- test/activesupport6/time_zone_test_helpers.rb
|
313
|
-
- test/bar.rb
|
314
|
-
- test/baz.rb
|
315
|
-
- test/files.rb
|
316
|
-
- test/foo.rb
|
317
|
-
- test/helper.rb
|
318
|
-
- test/isolated/shared.rb
|
319
|
-
- test/isolated/test_mimic_after.rb
|
320
|
-
- test/isolated/test_mimic_alone.rb
|
321
|
-
- test/isolated/test_mimic_as_json.rb
|
322
|
-
- test/isolated/test_mimic_before.rb
|
323
|
-
- test/isolated/test_mimic_define.rb
|
324
|
-
- test/isolated/test_mimic_rails_after.rb
|
325
|
-
- test/isolated/test_mimic_rails_before.rb
|
326
|
-
- test/isolated/test_mimic_redefine.rb
|
327
|
-
- test/json_gem/json_addition_test.rb
|
328
|
-
- test/json_gem/json_common_interface_test.rb
|
329
|
-
- test/json_gem/json_encoding_test.rb
|
330
|
-
- test/json_gem/json_ext_parser_test.rb
|
331
|
-
- test/json_gem/json_fixtures_test.rb
|
332
|
-
- test/json_gem/json_generator_test.rb
|
333
|
-
- test/json_gem/json_generic_object_test.rb
|
334
|
-
- test/json_gem/json_parser_test.rb
|
335
|
-
- test/json_gem/json_string_matching_test.rb
|
336
|
-
- test/json_gem/test_helper.rb
|
337
|
-
- test/perf.rb
|
338
|
-
- test/perf_compat.rb
|
339
|
-
- test/perf_fast.rb
|
340
|
-
- test/perf_file.rb
|
341
|
-
- test/perf_object.rb
|
342
|
-
- test/perf_saj.rb
|
343
|
-
- test/perf_scp.rb
|
344
|
-
- test/perf_simple.rb
|
345
|
-
- test/perf_strict.rb
|
346
|
-
- test/perf_wab.rb
|
347
|
-
- test/prec.rb
|
348
|
-
- test/sample/change.rb
|
349
|
-
- test/sample/dir.rb
|
350
|
-
- test/sample/doc.rb
|
351
|
-
- test/sample/file.rb
|
352
|
-
- test/sample/group.rb
|
353
|
-
- test/sample/hasprops.rb
|
354
|
-
- test/sample/layer.rb
|
355
|
-
- test/sample/line.rb
|
356
|
-
- test/sample/oval.rb
|
357
|
-
- test/sample/rect.rb
|
358
|
-
- test/sample/shape.rb
|
359
|
-
- test/sample/text.rb
|
360
|
-
- test/sample.rb
|
361
|
-
- test/sample_json.rb
|
362
|
-
- test/test_compat.rb
|
363
|
-
- test/test_custom.rb
|
364
|
-
- test/test_debian.rb
|
365
|
-
- test/test_fast.rb
|
366
|
-
- test/test_file.rb
|
367
|
-
- test/test_gc.rb
|
368
|
-
- test/test_generate.rb
|
369
|
-
- test/test_hash.rb
|
370
|
-
- test/test_integer_range.rb
|
371
|
-
- test/test_null.rb
|
372
|
-
- test/test_object.rb
|
373
|
-
- test/test_rails.rb
|
374
|
-
- test/test_saj.rb
|
375
|
-
- test/test_scp.rb
|
376
|
-
- test/test_strict.rb
|
377
|
-
- test/test_various.rb
|
378
|
-
- test/test_wab.rb
|
379
|
-
- test/test_writer.rb
|
380
|
-
- test/tests.rb
|
381
|
-
- test/tests_mimic.rb
|
382
|
-
- test/tests_mimic_addition.rb
|
383
|
-
- test/zoo.rb
|
329
|
+
test_files: []
|
data/ext/oj/hash.c
DELETED
@@ -1,131 +0,0 @@
|
|
1
|
-
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
2
|
-
// Licensed under the MIT License. See LICENSE file in the project root for license details.
|
3
|
-
|
4
|
-
#include "hash.h"
|
5
|
-
|
6
|
-
#include <stdint.h>
|
7
|
-
|
8
|
-
#define HASH_MASK 0x000003FF
|
9
|
-
#define HASH_SLOT_CNT 1024
|
10
|
-
|
11
|
-
typedef struct _keyVal {
|
12
|
-
struct _keyVal *next;
|
13
|
-
const char * key;
|
14
|
-
size_t len;
|
15
|
-
VALUE val;
|
16
|
-
} * KeyVal;
|
17
|
-
|
18
|
-
struct _hash {
|
19
|
-
struct _keyVal slots[HASH_SLOT_CNT];
|
20
|
-
};
|
21
|
-
|
22
|
-
struct _hash class_hash;
|
23
|
-
struct _hash intern_hash;
|
24
|
-
|
25
|
-
// almost the Murmur hash algorithm
|
26
|
-
#define M 0x5bd1e995
|
27
|
-
#define C1 0xCC9E2D51
|
28
|
-
#define C2 0x1B873593
|
29
|
-
#define N 0xE6546B64
|
30
|
-
|
31
|
-
static uint32_t hash_calc(const uint8_t *key, size_t len) {
|
32
|
-
const uint8_t *end = key + len;
|
33
|
-
const uint8_t *endless = key + (len / 4 * 4);
|
34
|
-
uint32_t h = (uint32_t)len;
|
35
|
-
uint32_t k;
|
36
|
-
|
37
|
-
while (key < endless) {
|
38
|
-
k = (uint32_t)*key++;
|
39
|
-
k |= (uint32_t)*key++ << 8;
|
40
|
-
k |= (uint32_t)*key++ << 16;
|
41
|
-
k |= (uint32_t)*key++ << 24;
|
42
|
-
|
43
|
-
k *= M;
|
44
|
-
k ^= k >> 24;
|
45
|
-
h *= M;
|
46
|
-
h ^= k * M;
|
47
|
-
}
|
48
|
-
if (1 < end - key) {
|
49
|
-
uint16_t k16 = (uint16_t)*key++;
|
50
|
-
|
51
|
-
k16 |= (uint16_t)*key++ << 8;
|
52
|
-
h ^= k16 << 8;
|
53
|
-
}
|
54
|
-
if (key < end) {
|
55
|
-
h ^= *key;
|
56
|
-
}
|
57
|
-
h *= M;
|
58
|
-
h ^= h >> 13;
|
59
|
-
h *= M;
|
60
|
-
h ^= h >> 15;
|
61
|
-
|
62
|
-
return h;
|
63
|
-
}
|
64
|
-
|
65
|
-
void oj_hash_init() {
|
66
|
-
memset(class_hash.slots, 0, sizeof(class_hash.slots));
|
67
|
-
memset(intern_hash.slots, 0, sizeof(intern_hash.slots));
|
68
|
-
}
|
69
|
-
|
70
|
-
// if slotp is 0 then just lookup
|
71
|
-
static VALUE hash_get(Hash hash, const char *key, size_t len, VALUE **slotp, VALUE def_value) {
|
72
|
-
uint32_t h = hash_calc((const uint8_t *)key, len) & HASH_MASK;
|
73
|
-
KeyVal bucket = hash->slots + h;
|
74
|
-
|
75
|
-
if (0 != bucket->key) {
|
76
|
-
KeyVal b;
|
77
|
-
|
78
|
-
for (b = bucket; 0 != b; b = b->next) {
|
79
|
-
if (len == b->len && 0 == strncmp(b->key, key, len)) {
|
80
|
-
*slotp = &b->val;
|
81
|
-
return b->val;
|
82
|
-
}
|
83
|
-
bucket = b;
|
84
|
-
}
|
85
|
-
}
|
86
|
-
if (0 != slotp) {
|
87
|
-
if (0 != bucket->key) {
|
88
|
-
KeyVal b = ALLOC(struct _keyVal);
|
89
|
-
|
90
|
-
b->next = 0;
|
91
|
-
bucket->next = b;
|
92
|
-
bucket = b;
|
93
|
-
}
|
94
|
-
bucket->key = oj_strndup(key, len);
|
95
|
-
bucket->len = len;
|
96
|
-
bucket->val = def_value;
|
97
|
-
*slotp = &bucket->val;
|
98
|
-
}
|
99
|
-
return def_value;
|
100
|
-
}
|
101
|
-
|
102
|
-
void oj_hash_print() {
|
103
|
-
int i;
|
104
|
-
KeyVal b;
|
105
|
-
|
106
|
-
for (i = 0; i < HASH_SLOT_CNT; i++) {
|
107
|
-
printf("%4d:", i);
|
108
|
-
for (b = class_hash.slots + i; 0 != b && 0 != b->key; b = b->next) {
|
109
|
-
printf(" %s", b->key);
|
110
|
-
}
|
111
|
-
printf("\n");
|
112
|
-
}
|
113
|
-
}
|
114
|
-
|
115
|
-
VALUE
|
116
|
-
oj_class_hash_get(const char *key, size_t len, VALUE **slotp) {
|
117
|
-
return hash_get(&class_hash, key, len, slotp, Qnil);
|
118
|
-
}
|
119
|
-
|
120
|
-
ID oj_attr_hash_get(const char *key, size_t len, ID **slotp) {
|
121
|
-
return (ID)hash_get(&intern_hash, key, len, (VALUE **)slotp, 0);
|
122
|
-
}
|
123
|
-
|
124
|
-
char *oj_strndup(const char *s, size_t len) {
|
125
|
-
char *d = ALLOC_N(char, len + 1);
|
126
|
-
|
127
|
-
memcpy(d, s, len);
|
128
|
-
d[len] = '\0';
|
129
|
-
|
130
|
-
return d;
|
131
|
-
}
|
data/ext/oj/hash.h
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
2
|
-
// Licensed under the MIT License. See LICENSE file in the project root for license details.
|
3
|
-
|
4
|
-
#ifndef OJ_HASH_H
|
5
|
-
#define OJ_HASH_H
|
6
|
-
|
7
|
-
#include "ruby.h"
|
8
|
-
|
9
|
-
typedef struct _hash *Hash;
|
10
|
-
|
11
|
-
extern void oj_hash_init();
|
12
|
-
|
13
|
-
extern VALUE oj_class_hash_get(const char *key, size_t len, VALUE **slotp);
|
14
|
-
extern ID oj_attr_hash_get(const char *key, size_t len, ID **slotp);
|
15
|
-
|
16
|
-
extern void oj_hash_print();
|
17
|
-
extern char *oj_strndup(const char *s, size_t len);
|
18
|
-
|
19
|
-
#endif /* OJ_HASH_H */
|