oj 2.18.3 → 3.13.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +1324 -0
  3. data/README.md +51 -204
  4. data/RELEASE_NOTES.md +61 -0
  5. data/ext/oj/buf.h +49 -72
  6. data/ext/oj/cache.c +326 -0
  7. data/ext/oj/cache.h +21 -0
  8. data/ext/oj/cache8.c +61 -64
  9. data/ext/oj/cache8.h +12 -39
  10. data/ext/oj/circarray.c +37 -68
  11. data/ext/oj/circarray.h +16 -42
  12. data/ext/oj/code.c +221 -0
  13. data/ext/oj/code.h +40 -0
  14. data/ext/oj/compat.c +231 -107
  15. data/ext/oj/custom.c +1125 -0
  16. data/ext/oj/debug.c +132 -0
  17. data/ext/oj/dump.c +935 -2513
  18. data/ext/oj/dump.h +108 -0
  19. data/ext/oj/dump_compat.c +936 -0
  20. data/ext/oj/dump_leaf.c +164 -0
  21. data/ext/oj/dump_object.c +761 -0
  22. data/ext/oj/dump_strict.c +410 -0
  23. data/ext/oj/encode.h +7 -42
  24. data/ext/oj/encoder.c +43 -0
  25. data/ext/oj/err.c +40 -54
  26. data/ext/oj/err.h +52 -46
  27. data/ext/oj/extconf.rb +21 -30
  28. data/ext/oj/fast.c +1097 -1080
  29. data/ext/oj/intern.c +301 -0
  30. data/ext/oj/intern.h +26 -0
  31. data/ext/oj/mimic_json.c +893 -0
  32. data/ext/oj/object.c +549 -620
  33. data/ext/oj/odd.c +155 -167
  34. data/ext/oj/odd.h +37 -63
  35. data/ext/oj/oj.c +1661 -2063
  36. data/ext/oj/oj.h +341 -270
  37. data/ext/oj/parse.c +974 -737
  38. data/ext/oj/parse.h +105 -97
  39. data/ext/oj/parser.c +1526 -0
  40. data/ext/oj/parser.h +90 -0
  41. data/ext/oj/rails.c +1504 -0
  42. data/ext/oj/rails.h +18 -0
  43. data/ext/oj/reader.c +141 -163
  44. data/ext/oj/reader.h +75 -113
  45. data/ext/oj/resolve.c +45 -93
  46. data/ext/oj/resolve.h +7 -34
  47. data/ext/oj/rxclass.c +143 -0
  48. data/ext/oj/rxclass.h +26 -0
  49. data/ext/oj/saj.c +447 -511
  50. data/ext/oj/saj2.c +348 -0
  51. data/ext/oj/scp.c +91 -138
  52. data/ext/oj/sparse.c +793 -644
  53. data/ext/oj/stream_writer.c +331 -0
  54. data/ext/oj/strict.c +145 -109
  55. data/ext/oj/string_writer.c +493 -0
  56. data/ext/oj/trace.c +72 -0
  57. data/ext/oj/trace.h +28 -0
  58. data/ext/oj/usual.c +1254 -0
  59. data/ext/oj/util.c +136 -0
  60. data/ext/oj/util.h +20 -0
  61. data/ext/oj/val_stack.c +62 -70
  62. data/ext/oj/val_stack.h +95 -129
  63. data/ext/oj/validate.c +51 -0
  64. data/ext/oj/wab.c +622 -0
  65. data/lib/oj/bag.rb +1 -0
  66. data/lib/oj/easy_hash.rb +17 -8
  67. data/lib/oj/error.rb +10 -11
  68. data/lib/oj/json.rb +176 -0
  69. data/lib/oj/mimic.rb +158 -19
  70. data/lib/oj/state.rb +132 -0
  71. data/lib/oj/version.rb +2 -2
  72. data/lib/oj.rb +1 -31
  73. data/pages/Advanced.md +22 -0
  74. data/pages/Compatibility.md +25 -0
  75. data/pages/Custom.md +23 -0
  76. data/pages/Encoding.md +65 -0
  77. data/pages/JsonGem.md +94 -0
  78. data/pages/Modes.md +161 -0
  79. data/pages/Options.md +327 -0
  80. data/pages/Parser.md +309 -0
  81. data/pages/Rails.md +167 -0
  82. data/pages/Security.md +20 -0
  83. data/pages/WAB.md +13 -0
  84. data/test/activerecord/result_test.rb +32 -0
  85. data/test/activesupport4/decoding_test.rb +108 -0
  86. data/test/activesupport4/encoding_test.rb +531 -0
  87. data/test/activesupport4/test_helper.rb +41 -0
  88. data/test/activesupport5/abstract_unit.rb +45 -0
  89. data/test/activesupport5/decoding_test.rb +133 -0
  90. data/test/activesupport5/encoding_test.rb +500 -0
  91. data/test/activesupport5/encoding_test_cases.rb +98 -0
  92. data/test/activesupport5/test_helper.rb +72 -0
  93. data/test/activesupport5/time_zone_test_helpers.rb +39 -0
  94. data/test/activesupport6/abstract_unit.rb +44 -0
  95. data/test/activesupport6/decoding_test.rb +133 -0
  96. data/test/activesupport6/encoding_test.rb +507 -0
  97. data/test/activesupport6/encoding_test_cases.rb +98 -0
  98. data/test/activesupport6/test_common.rb +17 -0
  99. data/test/activesupport6/test_helper.rb +163 -0
  100. data/test/activesupport6/time_zone_test_helpers.rb +39 -0
  101. data/test/activesupport7/abstract_unit.rb +49 -0
  102. data/test/activesupport7/decoding_test.rb +125 -0
  103. data/test/activesupport7/encoding_test.rb +486 -0
  104. data/test/activesupport7/encoding_test_cases.rb +104 -0
  105. data/test/activesupport7/time_zone_test_helpers.rb +47 -0
  106. data/test/bar.rb +9 -0
  107. data/test/baz.rb +16 -0
  108. data/test/bug.rb +11 -46
  109. data/test/foo.rb +69 -16
  110. data/test/helper.rb +10 -1
  111. data/test/isolated/shared.rb +12 -8
  112. data/test/isolated/test_mimic_rails_after.rb +3 -3
  113. data/test/isolated/test_mimic_rails_before.rb +3 -3
  114. data/test/json_gem/json_addition_test.rb +216 -0
  115. data/test/json_gem/json_common_interface_test.rb +153 -0
  116. data/test/json_gem/json_encoding_test.rb +107 -0
  117. data/test/json_gem/json_ext_parser_test.rb +20 -0
  118. data/test/json_gem/json_fixtures_test.rb +35 -0
  119. data/test/json_gem/json_generator_test.rb +397 -0
  120. data/test/json_gem/json_generic_object_test.rb +90 -0
  121. data/test/json_gem/json_parser_test.rb +470 -0
  122. data/test/json_gem/json_string_matching_test.rb +42 -0
  123. data/test/json_gem/test_helper.rb +26 -0
  124. data/test/mem.rb +33 -0
  125. data/test/perf.rb +1 -1
  126. data/test/perf_compat.rb +30 -28
  127. data/test/perf_dump.rb +50 -0
  128. data/test/perf_object.rb +1 -1
  129. data/test/perf_once.rb +58 -0
  130. data/test/perf_parser.rb +189 -0
  131. data/test/perf_scp.rb +11 -10
  132. data/test/perf_strict.rb +30 -19
  133. data/test/perf_wab.rb +131 -0
  134. data/test/prec.rb +23 -0
  135. data/test/sample.rb +0 -1
  136. data/test/sample_json.rb +1 -1
  137. data/test/test_compat.rb +219 -102
  138. data/test/test_custom.rb +533 -0
  139. data/test/test_fast.rb +107 -35
  140. data/test/test_file.rb +19 -25
  141. data/test/test_generate.rb +21 -0
  142. data/test/test_hash.rb +11 -1
  143. data/test/test_integer_range.rb +72 -0
  144. data/test/test_null.rb +376 -0
  145. data/test/test_object.rb +357 -70
  146. data/test/test_parser.rb +27 -0
  147. data/test/test_parser_saj.rb +245 -0
  148. data/test/test_parser_usual.rb +217 -0
  149. data/test/test_rails.rb +35 -0
  150. data/test/test_saj.rb +1 -1
  151. data/test/test_scp.rb +39 -2
  152. data/test/test_strict.rb +186 -7
  153. data/test/test_various.rb +160 -774
  154. data/test/test_wab.rb +307 -0
  155. data/test/test_writer.rb +90 -2
  156. data/test/tests.rb +24 -0
  157. data/test/tests_mimic.rb +14 -0
  158. data/test/tests_mimic_addition.rb +7 -0
  159. data/test/zoo.rb +13 -0
  160. metadata +194 -56
  161. data/ext/oj/hash.c +0 -163
  162. data/ext/oj/hash.h +0 -46
  163. data/ext/oj/hash_test.c +0 -512
  164. data/test/activesupport_datetime_test.rb +0 -23
  165. data/test/bug2.rb +0 -10
  166. data/test/bug3.rb +0 -46
  167. data/test/bug_fast.rb +0 -32
  168. data/test/bug_load.rb +0 -24
  169. data/test/crash.rb +0 -111
  170. data/test/curl/curl_oj.rb +0 -46
  171. data/test/curl/get_oj.rb +0 -24
  172. data/test/curl/just_curl.rb +0 -31
  173. data/test/curl/just_oj.rb +0 -51
  174. data/test/example.rb +0 -11
  175. data/test/io.rb +0 -48
  176. data/test/isolated/test_mimic_rails_datetime.rb +0 -27
  177. data/test/mod.rb +0 -16
  178. data/test/rails.rb +0 -50
  179. data/test/russian.rb +0 -18
  180. data/test/struct.rb +0 -29
  181. data/test/test_serializer.rb +0 -59
  182. data/test/write_timebars.rb +0 -31
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.18.3
4
+ version: 3.13.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-14 00:00:00.000000000 Z
11
+ date: 2022-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0.9'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: minitest
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,44 +45,72 @@ dependencies:
39
45
  - !ruby/object:Gem::Version
40
46
  version: '5'
41
47
  - !ruby/object:Gem::Dependency
42
- name: rails
48
+ name: test-unit
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '4'
53
+ version: '3.0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '4'
55
- description: 'The fastest JSON parser and object serializer. '
60
+ version: '3.0'
61
+ description: The fastest JSON parser and object serializer.
56
62
  email: peter@ohler.com
57
63
  executables: []
58
64
  extensions:
59
65
  - ext/oj/extconf.rb
60
66
  extra_rdoc_files:
61
67
  - README.md
68
+ - LICENSE
69
+ - CHANGELOG.md
70
+ - RELEASE_NOTES.md
71
+ - pages/Advanced.md
72
+ - pages/Compatibility.md
73
+ - pages/Custom.md
74
+ - pages/Encoding.md
75
+ - pages/JsonGem.md
76
+ - pages/Modes.md
77
+ - pages/Options.md
78
+ - pages/Parser.md
79
+ - pages/Rails.md
80
+ - pages/Security.md
81
+ - pages/WAB.md
62
82
  files:
83
+ - CHANGELOG.md
63
84
  - LICENSE
64
85
  - README.md
86
+ - RELEASE_NOTES.md
65
87
  - ext/oj/buf.h
88
+ - ext/oj/cache.c
89
+ - ext/oj/cache.h
66
90
  - ext/oj/cache8.c
67
91
  - ext/oj/cache8.h
68
92
  - ext/oj/circarray.c
69
93
  - ext/oj/circarray.h
94
+ - ext/oj/code.c
95
+ - ext/oj/code.h
70
96
  - ext/oj/compat.c
97
+ - ext/oj/custom.c
98
+ - ext/oj/debug.c
71
99
  - ext/oj/dump.c
100
+ - ext/oj/dump.h
101
+ - ext/oj/dump_compat.c
102
+ - ext/oj/dump_leaf.c
103
+ - ext/oj/dump_object.c
104
+ - ext/oj/dump_strict.c
72
105
  - ext/oj/encode.h
106
+ - ext/oj/encoder.c
73
107
  - ext/oj/err.c
74
108
  - ext/oj/err.h
75
109
  - ext/oj/extconf.rb
76
110
  - ext/oj/fast.c
77
- - ext/oj/hash.c
78
- - ext/oj/hash.h
79
- - ext/oj/hash_test.c
111
+ - ext/oj/intern.c
112
+ - ext/oj/intern.h
113
+ - ext/oj/mimic_json.c
80
114
  - ext/oj/object.c
81
115
  - ext/oj/odd.c
82
116
  - ext/oj/odd.h
@@ -84,44 +118,85 @@ files:
84
118
  - ext/oj/oj.h
85
119
  - ext/oj/parse.c
86
120
  - ext/oj/parse.h
121
+ - ext/oj/parser.c
122
+ - ext/oj/parser.h
123
+ - ext/oj/rails.c
124
+ - ext/oj/rails.h
87
125
  - ext/oj/reader.c
88
126
  - ext/oj/reader.h
89
127
  - ext/oj/resolve.c
90
128
  - ext/oj/resolve.h
129
+ - ext/oj/rxclass.c
130
+ - ext/oj/rxclass.h
91
131
  - ext/oj/saj.c
132
+ - ext/oj/saj2.c
92
133
  - ext/oj/scp.c
93
134
  - ext/oj/sparse.c
135
+ - ext/oj/stream_writer.c
94
136
  - ext/oj/strict.c
137
+ - ext/oj/string_writer.c
138
+ - ext/oj/trace.c
139
+ - ext/oj/trace.h
140
+ - ext/oj/usual.c
141
+ - ext/oj/util.c
142
+ - ext/oj/util.h
95
143
  - ext/oj/val_stack.c
96
144
  - ext/oj/val_stack.h
145
+ - ext/oj/validate.c
146
+ - ext/oj/wab.c
97
147
  - lib/oj.rb
98
148
  - lib/oj/active_support_helper.rb
99
149
  - lib/oj/bag.rb
100
150
  - lib/oj/easy_hash.rb
101
151
  - lib/oj/error.rb
152
+ - lib/oj/json.rb
102
153
  - lib/oj/mimic.rb
103
154
  - lib/oj/saj.rb
104
155
  - lib/oj/schandler.rb
156
+ - lib/oj/state.rb
105
157
  - lib/oj/version.rb
158
+ - pages/Advanced.md
159
+ - pages/Compatibility.md
160
+ - pages/Custom.md
161
+ - pages/Encoding.md
162
+ - pages/JsonGem.md
163
+ - pages/Modes.md
164
+ - pages/Options.md
165
+ - pages/Parser.md
166
+ - pages/Rails.md
167
+ - pages/Security.md
168
+ - pages/WAB.md
106
169
  - test/_test_active.rb
107
170
  - test/_test_active_mimic.rb
108
171
  - test/_test_mimic_rails.rb
109
- - test/activesupport_datetime_test.rb
172
+ - test/activerecord/result_test.rb
173
+ - test/activesupport4/decoding_test.rb
174
+ - test/activesupport4/encoding_test.rb
175
+ - test/activesupport4/test_helper.rb
176
+ - test/activesupport5/abstract_unit.rb
177
+ - test/activesupport5/decoding_test.rb
178
+ - test/activesupport5/encoding_test.rb
179
+ - test/activesupport5/encoding_test_cases.rb
180
+ - test/activesupport5/test_helper.rb
181
+ - test/activesupport5/time_zone_test_helpers.rb
182
+ - test/activesupport6/abstract_unit.rb
183
+ - test/activesupport6/decoding_test.rb
184
+ - test/activesupport6/encoding_test.rb
185
+ - test/activesupport6/encoding_test_cases.rb
186
+ - test/activesupport6/test_common.rb
187
+ - test/activesupport6/test_helper.rb
188
+ - test/activesupport6/time_zone_test_helpers.rb
189
+ - test/activesupport7/abstract_unit.rb
190
+ - test/activesupport7/decoding_test.rb
191
+ - test/activesupport7/encoding_test.rb
192
+ - test/activesupport7/encoding_test_cases.rb
193
+ - test/activesupport7/time_zone_test_helpers.rb
194
+ - test/bar.rb
195
+ - test/baz.rb
110
196
  - test/bug.rb
111
- - test/bug2.rb
112
- - test/bug3.rb
113
- - test/bug_fast.rb
114
- - test/bug_load.rb
115
- - test/crash.rb
116
- - test/curl/curl_oj.rb
117
- - test/curl/get_oj.rb
118
- - test/curl/just_curl.rb
119
- - test/curl/just_oj.rb
120
- - test/example.rb
121
197
  - test/files.rb
122
198
  - test/foo.rb
123
199
  - test/helper.rb
124
- - test/io.rb
125
200
  - test/isolated/shared.rb
126
201
  - test/isolated/test_mimic_after.rb
127
202
  - test/isolated/test_mimic_alone.rb
@@ -130,20 +205,32 @@ files:
130
205
  - test/isolated/test_mimic_define.rb
131
206
  - test/isolated/test_mimic_rails_after.rb
132
207
  - test/isolated/test_mimic_rails_before.rb
133
- - test/isolated/test_mimic_rails_datetime.rb
134
208
  - test/isolated/test_mimic_redefine.rb
135
- - test/mod.rb
209
+ - test/json_gem/json_addition_test.rb
210
+ - test/json_gem/json_common_interface_test.rb
211
+ - test/json_gem/json_encoding_test.rb
212
+ - test/json_gem/json_ext_parser_test.rb
213
+ - test/json_gem/json_fixtures_test.rb
214
+ - test/json_gem/json_generator_test.rb
215
+ - test/json_gem/json_generic_object_test.rb
216
+ - test/json_gem/json_parser_test.rb
217
+ - test/json_gem/json_string_matching_test.rb
218
+ - test/json_gem/test_helper.rb
219
+ - test/mem.rb
136
220
  - test/perf.rb
137
221
  - test/perf_compat.rb
222
+ - test/perf_dump.rb
138
223
  - test/perf_fast.rb
139
224
  - test/perf_file.rb
140
225
  - test/perf_object.rb
226
+ - test/perf_once.rb
227
+ - test/perf_parser.rb
141
228
  - test/perf_saj.rb
142
229
  - test/perf_scp.rb
143
230
  - test/perf_simple.rb
144
231
  - test/perf_strict.rb
145
- - test/rails.rb
146
- - test/russian.rb
232
+ - test/perf_wab.rb
233
+ - test/prec.rb
147
234
  - test/sample.rb
148
235
  - test/sample/change.rb
149
236
  - test/sample/dir.rb
@@ -158,27 +245,45 @@ files:
158
245
  - test/sample/shape.rb
159
246
  - test/sample/text.rb
160
247
  - test/sample_json.rb
161
- - test/struct.rb
162
248
  - test/test_compat.rb
249
+ - test/test_custom.rb
163
250
  - test/test_debian.rb
164
251
  - test/test_fast.rb
165
252
  - test/test_file.rb
166
253
  - test/test_gc.rb
254
+ - test/test_generate.rb
167
255
  - test/test_hash.rb
256
+ - test/test_integer_range.rb
257
+ - test/test_null.rb
168
258
  - test/test_object.rb
259
+ - test/test_parser.rb
260
+ - test/test_parser_saj.rb
261
+ - test/test_parser_usual.rb
262
+ - test/test_rails.rb
169
263
  - test/test_saj.rb
170
264
  - test/test_scp.rb
171
- - test/test_serializer.rb
172
265
  - test/test_strict.rb
173
266
  - test/test_various.rb
267
+ - test/test_wab.rb
174
268
  - test/test_writer.rb
175
- - test/write_timebars.rb
269
+ - test/tests.rb
270
+ - test/tests_mimic.rb
271
+ - test/tests_mimic_addition.rb
272
+ - test/zoo.rb
176
273
  homepage: http://www.ohler.com/oj
177
274
  licenses:
178
275
  - MIT
179
- metadata: {}
180
- post_install_message:
276
+ metadata:
277
+ bug_tracker_uri: https://github.com/ohler55/oj/issues
278
+ changelog_uri: https://github.com/ohler55/oj/blob/master/CHANGELOG.md
279
+ documentation_uri: http://www.ohler.com/oj/doc/index.html
280
+ homepage_uri: http://www.ohler.com/oj/
281
+ source_code_uri: https://github.com/ohler55/oj
282
+ wiki_uri: https://github.com/ohler55/oj/wiki
283
+ post_install_message:
181
284
  rdoc_options:
285
+ - "--title"
286
+ - Oj
182
287
  - "--main"
183
288
  - README.md
184
289
  require_paths:
@@ -187,38 +292,49 @@ required_ruby_version: !ruby/object:Gem::Requirement
187
292
  requirements:
188
293
  - - ">="
189
294
  - !ruby/object:Gem::Version
190
- version: '0'
295
+ version: '2.4'
191
296
  required_rubygems_version: !ruby/object:Gem::Requirement
192
297
  requirements:
193
298
  - - ">="
194
299
  - !ruby/object:Gem::Version
195
300
  version: '0'
196
301
  requirements: []
197
- rubyforge_project: oj
198
- rubygems_version: 2.5.2
199
- signing_key:
302
+ rubygems_version: 3.3.3
303
+ signing_key:
200
304
  specification_version: 4
201
305
  summary: A fast JSON parser and serializer.
202
306
  test_files:
203
307
  - test/_test_active.rb
204
308
  - test/_test_active_mimic.rb
205
309
  - test/_test_mimic_rails.rb
206
- - test/activesupport_datetime_test.rb
310
+ - test/activerecord/result_test.rb
311
+ - test/activesupport4/decoding_test.rb
312
+ - test/activesupport4/encoding_test.rb
313
+ - test/activesupport4/test_helper.rb
314
+ - test/activesupport5/abstract_unit.rb
315
+ - test/activesupport5/decoding_test.rb
316
+ - test/activesupport5/encoding_test.rb
317
+ - test/activesupport5/encoding_test_cases.rb
318
+ - test/activesupport5/test_helper.rb
319
+ - test/activesupport5/time_zone_test_helpers.rb
320
+ - test/activesupport6/abstract_unit.rb
321
+ - test/activesupport6/decoding_test.rb
322
+ - test/activesupport6/encoding_test.rb
323
+ - test/activesupport6/encoding_test_cases.rb
324
+ - test/activesupport6/test_common.rb
325
+ - test/activesupport6/test_helper.rb
326
+ - test/activesupport6/time_zone_test_helpers.rb
327
+ - test/activesupport7/abstract_unit.rb
328
+ - test/activesupport7/decoding_test.rb
329
+ - test/activesupport7/encoding_test.rb
330
+ - test/activesupport7/encoding_test_cases.rb
331
+ - test/activesupport7/time_zone_test_helpers.rb
332
+ - test/bar.rb
333
+ - test/baz.rb
207
334
  - test/bug.rb
208
- - test/bug2.rb
209
- - test/bug3.rb
210
- - test/bug_fast.rb
211
- - test/bug_load.rb
212
- - test/crash.rb
213
- - test/curl/curl_oj.rb
214
- - test/curl/get_oj.rb
215
- - test/curl/just_curl.rb
216
- - test/curl/just_oj.rb
217
- - test/example.rb
218
335
  - test/files.rb
219
336
  - test/foo.rb
220
337
  - test/helper.rb
221
- - test/io.rb
222
338
  - test/isolated/shared.rb
223
339
  - test/isolated/test_mimic_after.rb
224
340
  - test/isolated/test_mimic_alone.rb
@@ -227,20 +343,32 @@ test_files:
227
343
  - test/isolated/test_mimic_define.rb
228
344
  - test/isolated/test_mimic_rails_after.rb
229
345
  - test/isolated/test_mimic_rails_before.rb
230
- - test/isolated/test_mimic_rails_datetime.rb
231
346
  - test/isolated/test_mimic_redefine.rb
232
- - test/mod.rb
347
+ - test/json_gem/json_addition_test.rb
348
+ - test/json_gem/json_common_interface_test.rb
349
+ - test/json_gem/json_encoding_test.rb
350
+ - test/json_gem/json_ext_parser_test.rb
351
+ - test/json_gem/json_fixtures_test.rb
352
+ - test/json_gem/json_generator_test.rb
353
+ - test/json_gem/json_generic_object_test.rb
354
+ - test/json_gem/json_parser_test.rb
355
+ - test/json_gem/json_string_matching_test.rb
356
+ - test/json_gem/test_helper.rb
357
+ - test/mem.rb
233
358
  - test/perf.rb
234
359
  - test/perf_compat.rb
360
+ - test/perf_dump.rb
235
361
  - test/perf_fast.rb
236
362
  - test/perf_file.rb
237
363
  - test/perf_object.rb
364
+ - test/perf_once.rb
365
+ - test/perf_parser.rb
238
366
  - test/perf_saj.rb
239
367
  - test/perf_scp.rb
240
368
  - test/perf_simple.rb
241
369
  - test/perf_strict.rb
242
- - test/rails.rb
243
- - test/russian.rb
370
+ - test/perf_wab.rb
371
+ - test/prec.rb
244
372
  - test/sample/change.rb
245
373
  - test/sample/dir.rb
246
374
  - test/sample/doc.rb
@@ -255,18 +383,28 @@ test_files:
255
383
  - test/sample/text.rb
256
384
  - test/sample.rb
257
385
  - test/sample_json.rb
258
- - test/struct.rb
259
386
  - test/test_compat.rb
387
+ - test/test_custom.rb
260
388
  - test/test_debian.rb
261
389
  - test/test_fast.rb
262
390
  - test/test_file.rb
263
391
  - test/test_gc.rb
392
+ - test/test_generate.rb
264
393
  - test/test_hash.rb
394
+ - test/test_integer_range.rb
395
+ - test/test_null.rb
265
396
  - test/test_object.rb
397
+ - test/test_parser.rb
398
+ - test/test_parser_saj.rb
399
+ - test/test_parser_usual.rb
400
+ - test/test_rails.rb
266
401
  - test/test_saj.rb
267
402
  - test/test_scp.rb
268
- - test/test_serializer.rb
269
403
  - test/test_strict.rb
270
404
  - test/test_various.rb
405
+ - test/test_wab.rb
271
406
  - test/test_writer.rb
272
- - test/write_timebars.rb
407
+ - test/tests.rb
408
+ - test/tests_mimic.rb
409
+ - test/tests_mimic_addition.rb
410
+ - test/zoo.rb
data/ext/oj/hash.c DELETED
@@ -1,163 +0,0 @@
1
- /* hash.c
2
- * Copyright (c) 2011, Peter Ohler
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * - Redistributions of source code must retain the above copyright notice, this
9
- * list of conditions and the following disclaimer.
10
- *
11
- * - Redistributions in binary form must reproduce the above copyright notice,
12
- * this list of conditions and the following disclaimer in the documentation
13
- * and/or other materials provided with the distribution.
14
- *
15
- * - Neither the name of Peter Ohler nor the names of its contributors may be
16
- * used to endorse or promote products derived from this software without
17
- * specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
-
31
- #include "hash.h"
32
- #include <stdint.h>
33
-
34
- #define HASH_MASK 0x000003FF
35
- #define HASH_SLOT_CNT 1024
36
-
37
- typedef struct _KeyVal {
38
- struct _KeyVal *next;
39
- const char *key;
40
- size_t len;
41
- VALUE val;
42
- } *KeyVal;
43
-
44
- struct _Hash {
45
- struct _KeyVal slots[HASH_SLOT_CNT];
46
- };
47
-
48
- struct _Hash class_hash;
49
- struct _Hash intern_hash;
50
-
51
- // almost the Murmur hash algorithm
52
- #define M 0x5bd1e995
53
- #define C1 0xCC9E2D51
54
- #define C2 0x1B873593
55
- #define N 0xE6546B64
56
-
57
- static uint32_t
58
- hash_calc(const uint8_t *key, size_t len) {
59
- const uint8_t *end = key + len;
60
- const uint8_t *endless = key + (len / 4 * 4);
61
- uint32_t h = (uint32_t)len;
62
- uint32_t k;
63
-
64
- while (key < endless) {
65
- k = (uint32_t)*key++;
66
- k |= (uint32_t)*key++ << 8;
67
- k |= (uint32_t)*key++ << 16;
68
- k |= (uint32_t)*key++ << 24;
69
-
70
- k *= M;
71
- k ^= k >> 24;
72
- h *= M;
73
- h ^= k * M;
74
- }
75
- if (1 < end - key) {
76
- uint16_t k16 = (uint16_t)*key++;
77
-
78
- k16 |= (uint16_t)*key++ << 8;
79
- h ^= k16 << 8;
80
- }
81
- if (key < end) {
82
- h ^= *key;
83
- }
84
- h *= M;
85
- h ^= h >> 13;
86
- h *= M;
87
- h ^= h >> 15;
88
-
89
- return h;
90
- }
91
-
92
- void
93
- oj_hash_init() {
94
- memset(class_hash.slots, 0, sizeof(class_hash.slots));
95
- memset(intern_hash.slots, 0, sizeof(intern_hash.slots));
96
- }
97
-
98
- // if slotp is 0 then just lookup
99
- static VALUE
100
- hash_get(Hash hash, const char *key, size_t len, VALUE **slotp, VALUE def_value) {
101
- uint32_t h = hash_calc((const uint8_t*)key, len) & HASH_MASK;
102
- KeyVal bucket = hash->slots + h;
103
-
104
- if (0 != bucket->key) {
105
- KeyVal b;
106
-
107
- for (b = bucket; 0 != b; b = b->next) {
108
- if (len == b->len && 0 == strncmp(b->key, key, len)) {
109
- *slotp = &b->val;
110
- return b->val;
111
- }
112
- bucket = b;
113
- }
114
- }
115
- if (0 != slotp) {
116
- if (0 != bucket->key) {
117
- KeyVal b = ALLOC(struct _KeyVal);
118
-
119
- b->next = 0;
120
- bucket->next = b;
121
- bucket = b;
122
- }
123
- bucket->key = oj_strndup(key, len);
124
- bucket->len = len;
125
- bucket->val = def_value;
126
- *slotp = &bucket->val;
127
- }
128
- return def_value;
129
- }
130
-
131
- void
132
- oj_hash_print() {
133
- int i;
134
- KeyVal b;
135
-
136
- for (i = 0; i < HASH_SLOT_CNT; i++) {
137
- printf("%4d:", i);
138
- for (b = class_hash.slots + i; 0 != b && 0 != b->key; b = b->next) {
139
- printf(" %s", b->key);
140
- }
141
- printf("\n");
142
- }
143
- }
144
-
145
- VALUE
146
- oj_class_hash_get(const char *key, size_t len, VALUE **slotp) {
147
- return hash_get(&class_hash, key, len, slotp, Qnil);
148
- }
149
-
150
- ID
151
- oj_attr_hash_get(const char *key, size_t len, ID **slotp) {
152
- return (ID)hash_get(&intern_hash, key, len, (VALUE**)slotp, 0);
153
- }
154
-
155
- char*
156
- oj_strndup(const char *s, size_t len) {
157
- char *d = ALLOC_N(char, len + 1);
158
-
159
- memcpy(d, s, len);
160
- d[len] = '\0';
161
-
162
- return d;
163
- }
data/ext/oj/hash.h DELETED
@@ -1,46 +0,0 @@
1
- /* hash.h
2
- * Copyright (c) 2011, Peter Ohler
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * - Redistributions of source code must retain the above copyright notice, this
9
- * list of conditions and the following disclaimer.
10
- *
11
- * - Redistributions in binary form must reproduce the above copyright notice,
12
- * this list of conditions and the following disclaimer in the documentation
13
- * and/or other materials provided with the distribution.
14
- *
15
- * - Neither the name of Peter Ohler nor the names of its contributors may be
16
- * used to endorse or promote products derived from this software without
17
- * specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
-
31
- #ifndef __OJ_HASH_H__
32
- #define __OJ_HASH_H__
33
-
34
- #include "ruby.h"
35
-
36
- typedef struct _Hash *Hash;
37
-
38
- extern void oj_hash_init();
39
-
40
- extern VALUE oj_class_hash_get(const char *key, size_t len, VALUE **slotp);
41
- extern ID oj_attr_hash_get(const char *key, size_t len, ID **slotp);
42
-
43
- extern void oj_hash_print();
44
- extern char* oj_strndup(const char *s, size_t len);
45
-
46
- #endif /* __OJ_HASH_H__ */