oj 3.11.0 → 3.16.5

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.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1421 -0
  3. data/README.md +20 -5
  4. data/RELEASE_NOTES.md +61 -0
  5. data/ext/oj/buf.h +48 -38
  6. data/ext/oj/cache.c +329 -0
  7. data/ext/oj/cache.h +22 -0
  8. data/ext/oj/cache8.c +60 -62
  9. data/ext/oj/cache8.h +8 -7
  10. data/ext/oj/circarray.c +35 -35
  11. data/ext/oj/circarray.h +11 -9
  12. data/ext/oj/code.c +156 -174
  13. data/ext/oj/code.h +19 -18
  14. data/ext/oj/compat.c +140 -197
  15. data/ext/oj/custom.c +737 -879
  16. data/ext/oj/debug.c +126 -0
  17. data/ext/oj/dump.c +830 -835
  18. data/ext/oj/dump.h +65 -53
  19. data/ext/oj/dump_compat.c +566 -642
  20. data/ext/oj/dump_leaf.c +95 -182
  21. data/ext/oj/dump_object.c +518 -659
  22. data/ext/oj/dump_strict.c +301 -334
  23. data/ext/oj/encode.h +3 -4
  24. data/ext/oj/encoder.c +43 -0
  25. data/ext/oj/err.c +27 -24
  26. data/ext/oj/err.h +38 -13
  27. data/ext/oj/extconf.rb +23 -7
  28. data/ext/oj/fast.c +1043 -1073
  29. data/ext/oj/intern.c +313 -0
  30. data/ext/oj/intern.h +22 -0
  31. data/ext/oj/mem.c +318 -0
  32. data/ext/oj/mem.h +53 -0
  33. data/ext/oj/mimic_json.c +449 -423
  34. data/ext/oj/object.c +530 -576
  35. data/ext/oj/odd.c +155 -138
  36. data/ext/oj/odd.h +24 -22
  37. data/ext/oj/oj.c +1331 -993
  38. data/ext/oj/oj.h +306 -292
  39. data/ext/oj/parse.c +934 -938
  40. data/ext/oj/parse.h +73 -70
  41. data/ext/oj/parser.c +1600 -0
  42. data/ext/oj/parser.h +101 -0
  43. data/ext/oj/rails.c +795 -845
  44. data/ext/oj/rails.h +7 -7
  45. data/ext/oj/reader.c +132 -140
  46. data/ext/oj/reader.h +67 -78
  47. data/ext/oj/resolve.c +40 -59
  48. data/ext/oj/resolve.h +3 -2
  49. data/ext/oj/rxclass.c +67 -67
  50. data/ext/oj/rxclass.h +11 -9
  51. data/ext/oj/saj.c +441 -480
  52. data/ext/oj/saj2.c +584 -0
  53. data/ext/oj/saj2.h +23 -0
  54. data/ext/oj/scp.c +78 -111
  55. data/ext/oj/sparse.c +726 -730
  56. data/ext/oj/stream_writer.c +146 -165
  57. data/ext/oj/strict.c +103 -123
  58. data/ext/oj/string_writer.c +241 -253
  59. data/ext/oj/trace.c +29 -33
  60. data/ext/oj/trace.h +41 -11
  61. data/ext/oj/usual.c +1218 -0
  62. data/ext/oj/usual.h +69 -0
  63. data/ext/oj/util.c +103 -103
  64. data/ext/oj/util.h +3 -2
  65. data/ext/oj/val_stack.c +60 -49
  66. data/ext/oj/val_stack.h +79 -85
  67. data/ext/oj/validate.c +46 -0
  68. data/ext/oj/wab.c +307 -350
  69. data/lib/oj/active_support_helper.rb +1 -3
  70. data/lib/oj/bag.rb +8 -1
  71. data/lib/oj/easy_hash.rb +9 -9
  72. data/lib/oj/error.rb +1 -2
  73. data/lib/oj/json.rb +162 -150
  74. data/lib/oj/mimic.rb +9 -19
  75. data/lib/oj/saj.rb +20 -6
  76. data/lib/oj/schandler.rb +5 -4
  77. data/lib/oj/state.rb +12 -8
  78. data/lib/oj/version.rb +1 -2
  79. data/lib/oj.rb +2 -0
  80. data/pages/Compatibility.md +1 -1
  81. data/pages/InstallOptions.md +20 -0
  82. data/pages/JsonGem.md +15 -0
  83. data/pages/Modes.md +8 -3
  84. data/pages/Options.md +43 -5
  85. data/pages/Parser.md +309 -0
  86. data/pages/Rails.md +14 -2
  87. data/test/_test_active.rb +8 -9
  88. data/test/_test_active_mimic.rb +7 -8
  89. data/test/_test_mimic_rails.rb +17 -20
  90. data/test/activerecord/result_test.rb +12 -8
  91. data/test/activesupport6/encoding_test.rb +63 -28
  92. data/test/{activesupport5 → activesupport7}/abstract_unit.rb +16 -12
  93. data/test/{activesupport5 → activesupport7}/decoding_test.rb +2 -10
  94. data/test/{activesupport5 → activesupport7}/encoding_test.rb +86 -50
  95. data/test/{activesupport5 → activesupport7}/encoding_test_cases.rb +6 -0
  96. data/test/{activesupport5 → activesupport7}/time_zone_test_helpers.rb +8 -0
  97. data/test/files.rb +15 -15
  98. data/test/foo.rb +17 -43
  99. data/test/helper.rb +16 -3
  100. data/test/isolated/shared.rb +3 -2
  101. data/test/json_gem/json_addition_test.rb +2 -2
  102. data/test/json_gem/json_common_interface_test.rb +8 -6
  103. data/test/json_gem/json_encoding_test.rb +0 -0
  104. data/test/json_gem/json_ext_parser_test.rb +1 -0
  105. data/test/json_gem/json_fixtures_test.rb +3 -2
  106. data/test/json_gem/json_generator_test.rb +71 -41
  107. data/test/json_gem/json_generic_object_test.rb +11 -11
  108. data/test/json_gem/json_parser_test.rb +54 -47
  109. data/test/json_gem/json_string_matching_test.rb +9 -9
  110. data/test/json_gem/test_helper.rb +12 -0
  111. data/test/mem.rb +34 -0
  112. data/test/perf.rb +22 -27
  113. data/test/perf_compat.rb +31 -33
  114. data/test/perf_dump.rb +50 -0
  115. data/test/perf_fast.rb +80 -82
  116. data/test/perf_file.rb +27 -29
  117. data/test/perf_object.rb +65 -69
  118. data/test/perf_once.rb +59 -0
  119. data/test/perf_parser.rb +183 -0
  120. data/test/perf_saj.rb +46 -54
  121. data/test/perf_scp.rb +58 -69
  122. data/test/perf_simple.rb +41 -39
  123. data/test/perf_strict.rb +74 -82
  124. data/test/perf_wab.rb +67 -69
  125. data/test/prec.rb +5 -5
  126. data/test/sample/change.rb +0 -1
  127. data/test/sample/dir.rb +0 -1
  128. data/test/sample/doc.rb +0 -1
  129. data/test/sample/file.rb +0 -1
  130. data/test/sample/group.rb +0 -1
  131. data/test/sample/hasprops.rb +0 -1
  132. data/test/sample/layer.rb +0 -1
  133. data/test/sample/rect.rb +0 -1
  134. data/test/sample/shape.rb +0 -1
  135. data/test/sample/text.rb +0 -1
  136. data/test/sample.rb +16 -16
  137. data/test/sample_json.rb +8 -8
  138. data/test/test_compat.rb +97 -45
  139. data/test/test_custom.rb +73 -51
  140. data/test/test_debian.rb +7 -10
  141. data/test/test_fast.rb +135 -79
  142. data/test/test_file.rb +41 -30
  143. data/test/test_gc.rb +16 -5
  144. data/test/test_generate.rb +21 -0
  145. data/test/test_hash.rb +15 -5
  146. data/test/test_integer_range.rb +9 -9
  147. data/test/test_null.rb +20 -20
  148. data/test/test_object.rb +99 -96
  149. data/test/test_parser.rb +11 -0
  150. data/test/test_parser_debug.rb +27 -0
  151. data/test/test_parser_saj.rb +337 -0
  152. data/test/test_parser_usual.rb +251 -0
  153. data/test/test_rails.rb +2 -2
  154. data/test/test_saj.rb +10 -8
  155. data/test/test_scp.rb +38 -40
  156. data/test/test_strict.rb +40 -32
  157. data/test/test_various.rb +165 -84
  158. data/test/test_wab.rb +48 -44
  159. data/test/test_writer.rb +47 -47
  160. data/test/tests.rb +13 -5
  161. data/test/tests_mimic.rb +12 -3
  162. data/test/tests_mimic_addition.rb +12 -3
  163. metadata +75 -127
  164. data/ext/oj/hash.c +0 -135
  165. data/ext/oj/hash.h +0 -18
  166. data/ext/oj/hash_test.c +0 -484
  167. data/test/activesupport4/decoding_test.rb +0 -108
  168. data/test/activesupport4/encoding_test.rb +0 -531
  169. data/test/activesupport4/test_helper.rb +0 -41
  170. data/test/activesupport5/test_helper.rb +0 -72
  171. data/test/bar.rb +0 -35
  172. data/test/baz.rb +0 -16
  173. data/test/zoo.rb +0 -13
data/ext/oj/resolve.c CHANGED
@@ -1,99 +1,80 @@
1
1
  // Copyright (c) 2012 Peter Ohler. All rights reserved.
2
+ // Licensed under the MIT License. See LICENSE file in the project root for license details.
2
3
 
3
- #include <stdlib.h>
4
4
  #include <stdio.h>
5
+ #include <stdlib.h>
5
6
  #include <string.h>
6
7
  #ifdef HAVE_PTHREAD_MUTEX_INIT
7
8
  #include <pthread.h>
8
9
  #endif
9
10
 
10
- #include "oj.h"
11
11
  #include "err.h"
12
+ #include "intern.h"
13
+ #include "oj.h"
12
14
  #include "parse.h"
13
- #include "hash.h"
14
15
 
15
- inline static VALUE
16
- resolve_classname(VALUE mod, const char *classname, int auto_define) {
17
- VALUE clas;
18
- ID ci = rb_intern(classname);
16
+ inline static VALUE resolve_classname(VALUE mod, const char *classname, int auto_define) {
17
+ VALUE clas;
18
+ ID ci = rb_intern(classname);
19
19
 
20
20
  if (rb_const_defined_at(mod, ci)) {
21
- clas = rb_const_get_at(mod, ci);
21
+ clas = rb_const_get_at(mod, ci);
22
22
  } else if (auto_define) {
23
- clas = rb_define_class_under(mod, classname, oj_bag_class);
23
+ clas = rb_define_class_under(mod, classname, oj_bag_class);
24
24
  } else {
25
- clas = Qundef;
25
+ clas = Qundef;
26
26
  }
27
27
  return clas;
28
28
  }
29
29
 
30
- static VALUE
31
- resolve_classpath(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class) {
32
- char class_name[1024];
33
- VALUE clas;
34
- char *end = class_name + sizeof(class_name) - 1;
35
- char *s;
36
- const char *n = name;
30
+ static VALUE resolve_classpath(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class) {
31
+ char class_name[1024];
32
+ VALUE clas;
33
+ char *end = class_name + sizeof(class_name) - 1;
34
+ char *s;
35
+ const char *n = name;
37
36
 
38
37
  clas = rb_cObject;
39
38
  for (s = class_name; 0 < len; n++, len--) {
40
- if (':' == *n) {
41
- *s = '\0';
42
- n++;
43
- len--;
44
- if (':' != *n) {
45
- return Qundef;
46
- }
47
- if (Qundef == (clas = resolve_classname(clas, class_name, auto_define))) {
48
- return Qundef;
49
- }
50
- s = class_name;
51
- } else if (end <= s) {
52
- return Qundef;
53
- } else {
54
- *s++ = *n;
55
- }
39
+ if (':' == *n) {
40
+ *s = '\0';
41
+ n++;
42
+ len--;
43
+ if (':' != *n) {
44
+ return Qundef;
45
+ }
46
+ if (Qundef == (clas = resolve_classname(clas, class_name, auto_define))) {
47
+ return Qundef;
48
+ }
49
+ s = class_name;
50
+ } else if (end <= s) {
51
+ return Qundef;
52
+ } else {
53
+ *s++ = *n;
54
+ }
56
55
  }
57
56
  *s = '\0';
58
57
  if (Qundef == (clas = resolve_classname(clas, class_name, auto_define))) {
59
- oj_set_error_at(pi, error_class, __FILE__, __LINE__, "class %s is not defined", name);
60
- if (Qnil != error_class) {
61
- pi->err_class = error_class;
62
- }
58
+ oj_set_error_at(pi, error_class, __FILE__, __LINE__, "class %s is not defined", name);
59
+ if (Qnil != error_class) {
60
+ pi->err_class = error_class;
61
+ }
63
62
  }
64
63
  return clas;
65
64
  }
66
65
 
67
66
  VALUE
68
67
  oj_name2class(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class) {
69
- VALUE clas;
70
- VALUE *slot;
71
-
72
68
  if (No == pi->options.class_cache) {
73
- return resolve_classpath(pi, name, len, auto_define, error_class);
69
+ return resolve_classpath(pi, name, len, auto_define, error_class);
74
70
  }
75
- #ifdef HAVE_PTHREAD_MUTEX_INIT
76
- pthread_mutex_lock(&oj_cache_mutex);
77
- #else
78
- rb_mutex_lock(oj_cache_mutex);
79
- #endif
80
- if (Qnil == (clas = oj_class_hash_get(name, len, &slot))) {
81
- if (Qundef != (clas = resolve_classpath(pi, name, len, auto_define, error_class))) {
82
- *slot = clas;
83
- }
84
- }
85
- #ifdef HAVE_PTHREAD_MUTEX_INIT
86
- pthread_mutex_unlock(&oj_cache_mutex);
87
- #else
88
- rb_mutex_unlock(oj_cache_mutex);
89
- #endif
90
- return clas;
71
+ return oj_class_intern(name, len, true, pi, auto_define, error_class);
91
72
  }
92
73
 
93
74
  VALUE
94
75
  oj_name2struct(ParseInfo pi, VALUE nameVal, VALUE error_class) {
95
- size_t len = RSTRING_LEN(nameVal);
96
- const char *str = StringValuePtr(nameVal);
76
+ size_t len = RSTRING_LEN(nameVal);
77
+ const char *str = StringValuePtr(nameVal);
97
78
 
98
79
  return resolve_classpath(pi, str, len, 0, error_class);
99
80
  }
data/ext/oj/resolve.h CHANGED
@@ -1,11 +1,12 @@
1
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.
2
3
 
3
4
  #ifndef OJ_RESOLVE_H
4
5
  #define OJ_RESOLVE_H
5
6
 
6
7
  #include "ruby.h"
7
8
 
8
- extern VALUE oj_name2class(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class);
9
- extern VALUE oj_name2struct(ParseInfo pi, VALUE nameVal, VALUE error_class);
9
+ extern VALUE oj_name2class(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class);
10
+ extern VALUE oj_name2struct(ParseInfo pi, VALUE nameVal, VALUE error_class);
10
11
 
11
12
  #endif /* OJ_RESOLVE_H */
data/ext/oj/rxclass.c CHANGED
@@ -1,76 +1,77 @@
1
1
  // Copyright (c) 2017 Peter Ohler. All rights reserved.
2
+ // Licensed under the MIT License. See LICENSE file in the project root for license details.
2
3
 
3
- #include <sys/types.h>
4
- #include <stdlib.h>
5
4
  #include <errno.h>
6
- #include <string.h>
7
5
  #include <stdio.h>
6
+ #include <stdlib.h>
7
+ #include <string.h>
8
+ #include <sys/types.h>
8
9
  #if !IS_WINDOWS
9
10
  #include <regex.h>
10
11
  #endif
11
12
 
13
+ #include "mem.h"
12
14
  #include "rxclass.h"
13
15
 
14
16
  typedef struct _rxC {
15
- struct _rxC *next;
16
- VALUE rrx;
17
+ struct _rxC *next;
18
+ VALUE rrx;
17
19
  #if !IS_WINDOWS
18
- regex_t rx;
20
+ regex_t rx;
19
21
  #endif
20
- VALUE clas;
21
- char src[256];
22
+ VALUE clas;
23
+ char src[256];
22
24
  } *RxC;
23
25
 
24
- void
25
- oj_rxclass_init(RxClass rc) {
26
+ void oj_rxclass_init(RxClass rc) {
26
27
  *rc->err = '\0';
27
28
  rc->head = NULL;
28
29
  rc->tail = NULL;
29
30
  }
30
31
 
31
- void
32
- oj_rxclass_cleanup(RxClass rc) {
33
- RxC rxc;
32
+ void oj_rxclass_cleanup(RxClass rc) {
33
+ RxC rxc;
34
34
 
35
35
  while (NULL != (rxc = rc->head)) {
36
- rc->head = rc->head->next;
36
+ rc->head = rc->head->next;
37
37
  #if !IS_WINDOWS
38
- if (Qnil == rxc->rrx) {
39
- regfree(&rxc->rx);
40
- }
41
- xfree(rxc);
38
+ if (Qnil == rxc->rrx) {
39
+ regfree(&rxc->rx);
40
+ }
41
+ OJ_R_FREE(rxc);
42
42
  #endif
43
43
  }
44
44
  }
45
45
 
46
- void
47
- oj_rxclass_rappend(RxClass rc, VALUE rx, VALUE clas) {
48
- RxC rxc = ALLOC_N(struct _rxC, 1);
46
+ void oj_rxclass_rappend(RxClass rc, VALUE rx, VALUE clas) {
47
+ RxC rxc = OJ_R_ALLOC_N(struct _rxC, 1);
49
48
 
50
49
  memset(rxc, 0, sizeof(struct _rxC));
51
- rxc->rrx = rx;
50
+ rxc->rrx = rx;
52
51
  rxc->clas = clas;
53
52
  if (NULL == rc->tail) {
54
- rc->head = rxc;
53
+ rc->head = rxc;
55
54
  } else {
56
- rc->tail->next = rxc;
55
+ rc->tail->next = rxc;
57
56
  }
58
57
  rc->tail = rxc;
59
58
  }
60
59
 
61
60
  // Attempt to compile the expression. If it fails populate the error code..
62
- int
63
- oj_rxclass_append(RxClass rc, const char *expr, VALUE clas) {
64
- RxC rxc;
61
+ int oj_rxclass_append(RxClass rc, const char *expr, VALUE clas) {
62
+ RxC rxc;
65
63
  #if !IS_WINDOWS
66
- int err;
67
- int flags = 0;
64
+ int err;
65
+ int flags = 0;
68
66
  #endif
69
67
  if (sizeof(rxc->src) <= strlen(expr)) {
70
- snprintf(rc->err, sizeof(rc->err), "expressions must be less than %lu characters", (unsigned long)sizeof(rxc->src));
71
- return EINVAL;
68
+ snprintf(rc->err,
69
+ sizeof(rc->err),
70
+ "expressions must be less than %lu characters",
71
+ (unsigned long)sizeof(rxc->src));
72
+ return EINVAL;
72
73
  }
73
- rxc = ALLOC_N(struct _rxC, 1);
74
+ rxc = OJ_R_ALLOC_N(struct _rxC, 1);
74
75
  rxc->next = 0;
75
76
  rxc->clas = clas;
76
77
 
@@ -79,15 +80,15 @@ oj_rxclass_append(RxClass rc, const char *expr, VALUE clas) {
79
80
  #else
80
81
  rxc->rrx = Qnil;
81
82
  if (0 != (err = regcomp(&rxc->rx, expr, flags))) {
82
- regerror(err, &rxc->rx, rc->err, sizeof(rc->err));
83
- free(rxc);
84
- return err;
83
+ regerror(err, &rxc->rx, rc->err, sizeof(rc->err));
84
+ OJ_FREE(rxc);
85
+ return err;
85
86
  }
86
87
  #endif
87
88
  if (NULL == rc->tail) {
88
- rc->head = rxc;
89
+ rc->head = rxc;
89
90
  } else {
90
- rc->tail->next = rxc;
91
+ rc->tail->next = rxc;
91
92
  }
92
93
  rc->tail = rxc;
93
94
 
@@ -96,49 +97,48 @@ oj_rxclass_append(RxClass rc, const char *expr, VALUE clas) {
96
97
 
97
98
  VALUE
98
99
  oj_rxclass_match(RxClass rc, const char *str, int len) {
99
- RxC rxc;
100
- char buf[4096];
100
+ RxC rxc;
101
+ char buf[4096];
101
102
 
102
103
  for (rxc = rc->head; NULL != rxc; rxc = rxc->next) {
103
- if (Qnil != rxc->rrx) {
104
- // Must use a valiabel for this to work.
105
- volatile VALUE rstr = rb_str_new(str, len);
106
-
107
- //if (Qtrue == rb_funcall(rxc->rrx, rb_intern("match?"), 1, rstr)) {
108
- if (Qnil != rb_funcall(rxc->rrx, rb_intern("match"), 1, rstr)) {
109
- return rxc->clas;
110
- }
111
- } else if (len < (int)sizeof(buf)) {
104
+ if (Qnil != rxc->rrx) {
105
+ // Must use a valiabel for this to work.
106
+ volatile VALUE rstr = rb_str_new(str, len);
107
+
108
+ // if (Qtrue == rb_funcall(rxc->rrx, rb_intern("match?"), 1, rstr)) {
109
+ if (Qnil != rb_funcall(rxc->rrx, rb_intern("match"), 1, rstr)) {
110
+ return rxc->clas;
111
+ }
112
+ } else if (len < (int)sizeof(buf)) {
112
113
  #if !IS_WINDOWS
113
- // string is not \0 terminated so copy and atempt a match
114
- memcpy(buf, str, len);
115
- buf[len] = '\0';
116
- if (0 == regexec(&rxc->rx, buf, 0, NULL, 0)) { // match
117
- return rxc->clas;
118
- }
114
+ // string is not \0 terminated so copy and attempt a match
115
+ memcpy(buf, str, len);
116
+ buf[len] = '\0';
117
+ if (0 == regexec(&rxc->rx, buf, 0, NULL, 0)) { // match
118
+ return rxc->clas;
119
+ }
119
120
  #endif
120
- } else {
121
- // TBD allocate a larger buffer and attempt
122
- }
121
+ } else {
122
+ // TBD allocate a larger buffer and attempt
123
+ }
123
124
  }
124
125
  return Qnil;
125
126
  }
126
127
 
127
- void
128
- oj_rxclass_copy(RxClass src, RxClass dest) {
128
+ void oj_rxclass_copy(RxClass src, RxClass dest) {
129
129
  dest->head = NULL;
130
130
  dest->tail = NULL;
131
131
  if (NULL != src->head) {
132
- RxC rxc;
132
+ RxC rxc;
133
133
 
134
- for (rxc = src->head; NULL != rxc; rxc = rxc->next) {
135
- if (Qnil != rxc->rrx) {
136
- oj_rxclass_rappend(dest, rxc->rrx, rxc->clas);
137
- } else {
134
+ for (rxc = src->head; NULL != rxc; rxc = rxc->next) {
135
+ if (Qnil != rxc->rrx) {
136
+ oj_rxclass_rappend(dest, rxc->rrx, rxc->clas);
137
+ } else {
138
138
  #if !IS_WINDOWS
139
- oj_rxclass_append(dest, rxc->src, rxc->clas);
139
+ oj_rxclass_append(dest, rxc->src, rxc->clas);
140
140
  #endif
141
- }
142
- }
141
+ }
142
+ }
143
143
  }
144
144
  }
data/ext/oj/rxclass.h CHANGED
@@ -1,24 +1,26 @@
1
1
  // Copyright (c) 2017 Peter Ohler. All rights reserved.
2
+ // Licensed under the MIT License. See LICENSE file in the project root for license details.
2
3
 
3
4
  #ifndef OJ_RXCLASS_H
4
5
  #define OJ_RXCLASS_H
5
6
 
6
7
  #include <stdbool.h>
8
+
7
9
  #include "ruby.h"
8
10
 
9
11
  struct _rxC;
10
12
 
11
13
  typedef struct _rxClass {
12
- struct _rxC *head;
13
- struct _rxC *tail;
14
- char err[128];
14
+ struct _rxC *head;
15
+ struct _rxC *tail;
16
+ char err[128];
15
17
  } *RxClass;
16
18
 
17
- extern void oj_rxclass_init(RxClass rc);
18
- extern void oj_rxclass_cleanup(RxClass rc);
19
- extern int oj_rxclass_append(RxClass rc, const char *expr, VALUE clas);
20
- extern VALUE oj_rxclass_match(RxClass rc, const char *str, int len);
21
- extern void oj_rxclass_copy(RxClass src, RxClass dest);
22
- extern void oj_rxclass_rappend(RxClass rc, VALUE rx, VALUE clas);
19
+ extern void oj_rxclass_init(RxClass rc);
20
+ extern void oj_rxclass_cleanup(RxClass rc);
21
+ extern int oj_rxclass_append(RxClass rc, const char *expr, VALUE clas);
22
+ extern VALUE oj_rxclass_match(RxClass rc, const char *str, int len);
23
+ extern void oj_rxclass_copy(RxClass src, RxClass dest);
24
+ extern void oj_rxclass_rappend(RxClass rc, VALUE rx, VALUE clas);
23
25
 
24
26
  #endif /* OJ_RXCLASS_H */