oj 3.13.22 → 3.14.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.13.22
4
+ version: 3.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-01 00:00:00.000000000 Z
11
+ date: 2023-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -72,6 +72,7 @@ extra_rdoc_files:
72
72
  - pages/Compatibility.md
73
73
  - pages/Custom.md
74
74
  - pages/Encoding.md
75
+ - pages/InstallOptions.md
75
76
  - pages/JsonGem.md
76
77
  - pages/Modes.md
77
78
  - pages/Options.md
@@ -110,7 +111,6 @@ files:
110
111
  - ext/oj/fast.c
111
112
  - ext/oj/intern.c
112
113
  - ext/oj/intern.h
113
- - ext/oj/introspect.c
114
114
  - ext/oj/mimic_json.c
115
115
  - ext/oj/object.c
116
116
  - ext/oj/odd.c
@@ -162,6 +162,7 @@ files:
162
162
  - pages/Compatibility.md
163
163
  - pages/Custom.md
164
164
  - pages/Encoding.md
165
+ - pages/InstallOptions.md
165
166
  - pages/JsonGem.md
166
167
  - pages/Modes.md
167
168
  - pages/Options.md
data/ext/oj/introspect.c DELETED
@@ -1,96 +0,0 @@
1
-
2
- #include "cache.h"
3
- #include "oj.h"
4
- #include "parser.h"
5
- #include "usual.h"
6
-
7
- #define BYTE_OFFSETS_STACK_INC_SIZE 256
8
-
9
- VALUE mod = Qnil;
10
-
11
- typedef struct _introspect {
12
- struct _usual usual;
13
- void (*start)(struct _ojParser *p);
14
- void (*free)(struct _ojParser *p);
15
- void (*mark)(struct _ojParser *p);
16
- void (*open_object)(struct _ojParser *p);
17
- void (*close_object)(struct _ojParser *p);
18
-
19
- int len;
20
- int cur;
21
- long *stack;
22
-
23
- } * Introspect;
24
-
25
- static void dfree(ojParser p) {
26
- Introspect d = (Introspect)p->ctx;
27
-
28
- xfree(d->stack);
29
- // As with the mark() function, this function should still work.
30
- d->free(p);
31
- }
32
-
33
- static void start(ojParser p) {
34
- Introspect d = (Introspect)p->ctx;
35
-
36
- d->start(p);
37
-
38
- d->stack = ALLOC_N(long, BYTE_OFFSETS_STACK_INC_SIZE);
39
- d->len = BYTE_OFFSETS_STACK_INC_SIZE;
40
- d->cur = 0;
41
- }
42
-
43
- static void open_object(ojParser p) {
44
- Introspect d = (Introspect)p->ctx;
45
-
46
- d->open_object(p);
47
-
48
- // TBD add offset
49
- }
50
-
51
- static void close_object(ojParser p) {
52
- Introspect d = (Introspect)p->ctx;
53
-
54
- d->close_object(p);
55
-
56
- // TBD set offset on hash
57
- }
58
-
59
- static VALUE new_parser(VALUE self, VALUE ropts) {
60
- volatile VALUE pv = oj_parser_new();
61
- ojParser p = (ojParser)DATA_PTR(pv);
62
- Introspect d = ALLOC(struct _introspect);
63
-
64
- oj_init_usual(p, &d->usual);
65
-
66
- // Set the options before switching to the Introspect delegate.
67
- p->ctx = (void *)d;
68
-
69
- d->free = p->free;
70
- p->free = dfree;
71
-
72
- d->start = p->start;
73
- p->start = start;
74
-
75
- // We are cheating with the mark, free, and options functions. Since
76
- // struct _usual is the first member of struct _introspect the cast to
77
- // Usual in the usual.c mark() function should still work just fine.
78
-
79
- d->open_object = p->funcs[TOP_FUN].open_object;
80
- p->funcs[TOP_FUN].open_object = open_object;
81
-
82
- d->close_object = p->funcs[TOP_FUN].close_object;
83
- p->funcs[TOP_FUN].close_object = close_object;
84
-
85
- Check_Type(ropts, T_HASH);
86
- oj_parser_set_option(p, ropts);
87
-
88
- return pv;
89
- }
90
-
91
- void Init_introspect(void) {
92
- mod = rb_define_module("Introspect");
93
- rb_gc_register_address(&mod);
94
-
95
- rb_define_module_function(mod, "parser", new_parser, 1);
96
- }