yeptris 0.6.5.2 → 0.6.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5db1fcb20a8e18b3d9d45fe2203ce16c03480f5e3011a6da1b220074f42e6990
4
- data.tar.gz: 537d5ecf7f49915d0dbc6cf3febccd9e1017d20eeb52df69cef6c1a1b570b6c7
3
+ metadata.gz: ec5a8bfeb0851d4287965e0f7c162cf13b71c90bdbb1f423a2bb0a8f508d22e4
4
+ data.tar.gz: d757361d8e14a3f94f34419e71334c4c139dc60aaab7aaf638c9dd88239811c5
5
5
  SHA512:
6
- metadata.gz: e127efe17b1ae2cbcb33efacf5dd1c307b7c55ceb19e1198bfba18e17ae1bfee92b29a9115afd79071afff80cf1f99a14f5fdfbc7f75d8ce301fbe96b95640a3
7
- data.tar.gz: c9edd5aa40181c2deb87ab3b46367a76fa40dea1e0d0f949de1125e822f80f11040a32dd1c5bb8c25d377bf15cc2f30e08a4d8306d2041d60f9b133cee40b810
6
+ metadata.gz: 75c1451044793867918c6d9972ba7c452d79684c00e7b92a59a30f392bb741fe6c04b6e6571c3c7e6b956c14e7511bd48ba81ab79e552f54675d6726c2dd24d7
7
+ data.tar.gz: debf5f3377d19dfba238bb412145e7335480dbde4f5c3cff8b8d51aea7426f26038a8913caf1902a92e633684377c52994f10a342e39d2a67a68a5739468ba45
@@ -1,5 +1,14 @@
1
+
1
2
  /* json_ruby.c — fused RFC 8259 → Ruby VALUE (TODO.restructure/22). */
2
3
  #include <ruby.h>
4
+ /* rb_hash_new_capa is Ruby 3.2+; older Rubies grow dynamically (the
5
+ * FFI fallback stays correct on every minor either way). */
6
+ #if RUBY_API_VERSION_MAJOR > 3 || (RUBY_API_VERSION_MAJOR == 3 && RUBY_API_VERSION_MINOR >= 2)
7
+ #define HASH_NEW_CAPA(n) rb_hash_new_capa(n)
8
+ #else
9
+ #define HASH_NEW_CAPA(n) rb_hash_new()
10
+ #endif
11
+
3
12
  #include <ruby/encoding.h>
4
13
  #include <ruby/intern.h>
5
14
  #include <stdlib.h>
@@ -151,7 +160,7 @@ static int yep_ins_mode = YEP_INS_BULK;
151
160
  static VALUE jr_object(jr* j) {
152
161
  j->i++; j->depth++;
153
162
  if (yep_shape_mode == YEP_SHAPE_PRE) {
154
- VALUE h = rb_hash_new_capa(8);
163
+ VALUE h = HASH_NEW_CAPA(8);
155
164
  jr_ws(j);
156
165
  if (j->i < j->len && j->p[j->i] == '}') { j->i++; j->depth--; return h; }
157
166
  return jr_object_body(j, h);
@@ -178,7 +187,7 @@ static VALUE jr_object_body(jr* j, VALUE h_pre) {
178
187
  VALUE val = jr_value(j);
179
188
  if (j->err) goto out;
180
189
  if (yep_ins_mode == YEP_INS_ASET || j->strict_dup) {
181
- VALUE h = h_pre == Qundef ? (h_pre = rb_hash_new_capa(8)) : h_pre;
190
+ VALUE h = h_pre == Qundef ? (h_pre = HASH_NEW_CAPA(8)) : h_pre;
182
191
  if (j->strict_dup && !NIL_P(rb_hash_aref(h, key))) {
183
192
  j->err = -3;
184
193
  j->dup_key = key;
@@ -204,13 +213,13 @@ static VALUE jr_object_body(jr* j, VALUE h_pre) {
204
213
  j->err = -2; goto out;
205
214
  }
206
215
  if (yep_ins_mode == YEP_INS_BULK) {
207
- VALUE h = (h_pre == Qundef) ? rb_hash_new_capa((long)(pn / 2)) : h_pre;
216
+ VALUE h = (h_pre == Qundef) ? HASH_NEW_CAPA((long)(pn / 2)) : h_pre;
208
217
  rb_hash_bulk_insert((long)pn, (const VALUE*)pv, h);
209
218
  if (pv != pairs) { free(pv); }
210
219
  j->depth--;
211
220
  return h;
212
221
  }
213
- if (h_pre == Qundef) { h_pre = rb_hash_new_capa(8); }
222
+ if (h_pre == Qundef) { h_pre = HASH_NEW_CAPA(8); }
214
223
  out:
215
224
  if (pv != pairs) { free(pv); (void)heap_cap; }
216
225
  if (j->err) return Qnil;
@@ -309,6 +318,8 @@ void yep_rb_set_gc_mode(int mode) {
309
318
  * same scan kernels through the null vtable. Decomposes scan vs
310
319
  * materialize cost. Returns seconds for n iterations. */
311
320
  #include <time.h>
321
+
322
+
312
323
  double yep_rb_scan_time(const char* p, size_t len, int n) {
313
324
  static const YeptrisVisitVTable none = {0};
314
325
  struct timespec t0, t1;
data/lib/yeptris/ffi.rb CHANGED
@@ -28,6 +28,18 @@ module Yeptris
28
28
  MSG
29
29
  end
30
30
 
31
+ # :c_free (:free, line ~240) must resolve against the C runtime.
32
+ # Linux/macOS fall through to the process symbol table, but
33
+ # Windows has no such fallback — without LIBC attached the
34
+ # ffi.rb load DIED at that attach (leaving every later constant
35
+ # undefined: the mingw gem's missing NODE_* / #318).
36
+ begin
37
+ ffi_lib FFI::Library::LIBC
38
+ rescue StandardError
39
+ # no LIBC handle: the c_free attach below surfaces the failure
40
+ # exactly where it used to, on non-Windows platforms only
41
+ end
42
+
31
43
  typedef :pointer, :yeptris_document
32
44
  typedef :pointer, :yeptris_node
33
45
  typedef :pointer, :yeptris_status_out
data/lib/yeptris.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Yeptris
4
4
  # The gem's version lives in the parent namespace's file — the last
5
5
  # internal require (yeptris/version) retired with it.
6
- VERSION = "0.6.5.2".freeze
6
+ VERSION = "0.6.5.4".freeze
7
7
  # The error hierarchy lives in THIS file (the parent namespace's
8
8
  # own file): nested constants do not trigger a parent-constant
9
9
  # autoload, and the law forbids internal requires — defining the
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yeptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5.2
4
+ version: 0.6.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -71,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: '3.1'
74
+ version: '3.0'
75
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - ">="