oj 3.9.1 → 3.16.11

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 (171) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1452 -0
  3. data/README.md +21 -6
  4. data/RELEASE_NOTES.md +61 -0
  5. data/ext/oj/buf.h +50 -68
  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 +9 -36
  10. data/ext/oj/circarray.c +38 -42
  11. data/ext/oj/circarray.h +12 -13
  12. data/ext/oj/code.c +158 -179
  13. data/ext/oj/code.h +20 -22
  14. data/ext/oj/compat.c +145 -205
  15. data/ext/oj/custom.c +740 -880
  16. data/ext/oj/debug.c +126 -0
  17. data/ext/oj/dump.c +1145 -844
  18. data/ext/oj/dump.h +71 -57
  19. data/ext/oj/dump_compat.c +575 -655
  20. data/ext/oj/dump_leaf.c +96 -186
  21. data/ext/oj/dump_object.c +533 -660
  22. data/ext/oj/dump_strict.c +306 -340
  23. data/ext/oj/encode.h +4 -33
  24. data/ext/oj/encoder.c +43 -0
  25. data/ext/oj/err.c +28 -28
  26. data/ext/oj/err.h +39 -42
  27. data/ext/oj/extconf.rb +28 -7
  28. data/ext/oj/fast.c +1052 -1113
  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 +471 -430
  34. data/ext/oj/object.c +532 -580
  35. data/ext/oj/odd.c +156 -142
  36. data/ext/oj/odd.h +25 -26
  37. data/ext/oj/oj.c +1346 -961
  38. data/ext/oj/oj.h +307 -290
  39. data/ext/oj/parse.c +954 -858
  40. data/ext/oj/parse.h +74 -72
  41. data/ext/oj/parser.c +1600 -0
  42. data/ext/oj/parser.h +103 -0
  43. data/ext/oj/rails.c +819 -836
  44. data/ext/oj/rails.h +8 -11
  45. data/ext/oj/reader.c +136 -147
  46. data/ext/oj/reader.h +69 -83
  47. data/ext/oj/resolve.c +41 -63
  48. data/ext/oj/resolve.h +4 -6
  49. data/ext/oj/rxclass.c +69 -72
  50. data/ext/oj/rxclass.h +12 -13
  51. data/ext/oj/saj.c +440 -485
  52. data/ext/oj/saj2.c +584 -0
  53. data/ext/oj/saj2.h +23 -0
  54. data/ext/oj/scp.c +79 -118
  55. data/ext/oj/simd.h +10 -0
  56. data/ext/oj/sparse.c +739 -709
  57. data/ext/oj/stream_writer.c +141 -175
  58. data/ext/oj/strict.c +103 -128
  59. data/ext/oj/string_writer.c +244 -261
  60. data/ext/oj/trace.c +34 -41
  61. data/ext/oj/trace.h +42 -15
  62. data/ext/oj/usual.c +1218 -0
  63. data/ext/oj/usual.h +69 -0
  64. data/ext/oj/util.c +107 -107
  65. data/ext/oj/util.h +4 -3
  66. data/ext/oj/val_stack.c +61 -78
  67. data/ext/oj/val_stack.h +80 -114
  68. data/ext/oj/validate.c +46 -0
  69. data/ext/oj/wab.c +316 -361
  70. data/lib/oj/active_support_helper.rb +1 -3
  71. data/lib/oj/bag.rb +8 -1
  72. data/lib/oj/easy_hash.rb +9 -9
  73. data/lib/oj/error.rb +1 -2
  74. data/lib/oj/json.rb +162 -150
  75. data/lib/oj/mimic.rb +54 -20
  76. data/lib/oj/saj.rb +20 -6
  77. data/lib/oj/schandler.rb +5 -4
  78. data/lib/oj/state.rb +12 -8
  79. data/lib/oj/version.rb +1 -2
  80. data/lib/oj.rb +2 -8
  81. data/pages/Compatibility.md +1 -1
  82. data/pages/Encoding.md +1 -1
  83. data/pages/InstallOptions.md +20 -0
  84. data/pages/JsonGem.md +15 -0
  85. data/pages/Modes.md +9 -3
  86. data/pages/Options.md +62 -12
  87. data/pages/Parser.md +309 -0
  88. data/pages/Rails.md +73 -22
  89. metadata +68 -192
  90. data/ext/oj/hash.c +0 -163
  91. data/ext/oj/hash.h +0 -46
  92. data/ext/oj/hash_test.c +0 -512
  93. data/test/_test_active.rb +0 -76
  94. data/test/_test_active_mimic.rb +0 -96
  95. data/test/_test_mimic_rails.rb +0 -126
  96. data/test/activerecord/result_test.rb +0 -27
  97. data/test/activesupport4/decoding_test.rb +0 -108
  98. data/test/activesupport4/encoding_test.rb +0 -531
  99. data/test/activesupport4/test_helper.rb +0 -41
  100. data/test/activesupport5/decoding_test.rb +0 -125
  101. data/test/activesupport5/encoding_test.rb +0 -485
  102. data/test/activesupport5/encoding_test_cases.rb +0 -90
  103. data/test/activesupport5/test_helper.rb +0 -50
  104. data/test/activesupport5/time_zone_test_helpers.rb +0 -24
  105. data/test/bar.rb +0 -25
  106. data/test/files.rb +0 -29
  107. data/test/foo.rb +0 -21
  108. data/test/helper.rb +0 -26
  109. data/test/isolated/shared.rb +0 -308
  110. data/test/isolated/test_mimic_after.rb +0 -13
  111. data/test/isolated/test_mimic_alone.rb +0 -12
  112. data/test/isolated/test_mimic_as_json.rb +0 -45
  113. data/test/isolated/test_mimic_before.rb +0 -13
  114. data/test/isolated/test_mimic_define.rb +0 -28
  115. data/test/isolated/test_mimic_rails_after.rb +0 -22
  116. data/test/isolated/test_mimic_rails_before.rb +0 -21
  117. data/test/isolated/test_mimic_redefine.rb +0 -15
  118. data/test/json_gem/json_addition_test.rb +0 -216
  119. data/test/json_gem/json_common_interface_test.rb +0 -148
  120. data/test/json_gem/json_encoding_test.rb +0 -107
  121. data/test/json_gem/json_ext_parser_test.rb +0 -20
  122. data/test/json_gem/json_fixtures_test.rb +0 -35
  123. data/test/json_gem/json_generator_test.rb +0 -383
  124. data/test/json_gem/json_generic_object_test.rb +0 -90
  125. data/test/json_gem/json_parser_test.rb +0 -470
  126. data/test/json_gem/json_string_matching_test.rb +0 -42
  127. data/test/json_gem/test_helper.rb +0 -18
  128. data/test/perf.rb +0 -107
  129. data/test/perf_compat.rb +0 -130
  130. data/test/perf_fast.rb +0 -164
  131. data/test/perf_file.rb +0 -64
  132. data/test/perf_object.rb +0 -138
  133. data/test/perf_saj.rb +0 -109
  134. data/test/perf_scp.rb +0 -151
  135. data/test/perf_simple.rb +0 -287
  136. data/test/perf_strict.rb +0 -145
  137. data/test/perf_wab.rb +0 -131
  138. data/test/sample/change.rb +0 -14
  139. data/test/sample/dir.rb +0 -19
  140. data/test/sample/doc.rb +0 -36
  141. data/test/sample/file.rb +0 -48
  142. data/test/sample/group.rb +0 -16
  143. data/test/sample/hasprops.rb +0 -16
  144. data/test/sample/layer.rb +0 -12
  145. data/test/sample/line.rb +0 -20
  146. data/test/sample/oval.rb +0 -10
  147. data/test/sample/rect.rb +0 -10
  148. data/test/sample/shape.rb +0 -35
  149. data/test/sample/text.rb +0 -20
  150. data/test/sample.rb +0 -54
  151. data/test/sample_json.rb +0 -37
  152. data/test/test_compat.rb +0 -509
  153. data/test/test_custom.rb +0 -503
  154. data/test/test_debian.rb +0 -53
  155. data/test/test_fast.rb +0 -470
  156. data/test/test_file.rb +0 -239
  157. data/test/test_gc.rb +0 -49
  158. data/test/test_hash.rb +0 -29
  159. data/test/test_integer_range.rb +0 -73
  160. data/test/test_null.rb +0 -376
  161. data/test/test_object.rb +0 -1018
  162. data/test/test_saj.rb +0 -186
  163. data/test/test_scp.rb +0 -433
  164. data/test/test_strict.rb +0 -410
  165. data/test/test_various.rb +0 -741
  166. data/test/test_wab.rb +0 -307
  167. data/test/test_writer.rb +0 -380
  168. data/test/tests.rb +0 -24
  169. data/test/tests_mimic.rb +0 -14
  170. data/test/tests_mimic_addition.rb +0 -7
  171. data/test/zoo.rb +0 -13
data/ext/oj/resolve.c CHANGED
@@ -1,102 +1,80 @@
1
- /* resolve.c
2
- * Copyright (c) 2012, Peter Ohler
3
- * All rights reserved.
4
- */
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.
5
3
 
6
- #include <stdlib.h>
7
4
  #include <stdio.h>
5
+ #include <stdlib.h>
8
6
  #include <string.h>
9
7
  #ifdef HAVE_PTHREAD_MUTEX_INIT
10
8
  #include <pthread.h>
11
9
  #endif
12
10
 
13
- #include "oj.h"
14
11
  #include "err.h"
12
+ #include "intern.h"
13
+ #include "oj.h"
15
14
  #include "parse.h"
16
- #include "hash.h"
17
15
 
18
- inline static VALUE
19
- resolve_classname(VALUE mod, const char *classname, int auto_define) {
20
- VALUE clas;
21
- 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);
22
19
 
23
20
  if (rb_const_defined_at(mod, ci)) {
24
- clas = rb_const_get_at(mod, ci);
21
+ clas = rb_const_get_at(mod, ci);
25
22
  } else if (auto_define) {
26
- clas = rb_define_class_under(mod, classname, oj_bag_class);
23
+ clas = rb_define_class_under(mod, classname, oj_bag_class);
27
24
  } else {
28
- clas = Qundef;
25
+ clas = Qundef;
29
26
  }
30
27
  return clas;
31
28
  }
32
29
 
33
- static VALUE
34
- resolve_classpath(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class) {
35
- char class_name[1024];
36
- VALUE clas;
37
- char *end = class_name + sizeof(class_name) - 1;
38
- char *s;
39
- 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;
40
36
 
41
37
  clas = rb_cObject;
42
38
  for (s = class_name; 0 < len; n++, len--) {
43
- if (':' == *n) {
44
- *s = '\0';
45
- n++;
46
- len--;
47
- if (':' != *n) {
48
- return Qundef;
49
- }
50
- if (Qundef == (clas = resolve_classname(clas, class_name, auto_define))) {
51
- return Qundef;
52
- }
53
- s = class_name;
54
- } else if (end <= s) {
55
- return Qundef;
56
- } else {
57
- *s++ = *n;
58
- }
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
+ }
59
55
  }
60
56
  *s = '\0';
61
57
  if (Qundef == (clas = resolve_classname(clas, class_name, auto_define))) {
62
- oj_set_error_at(pi, error_class, __FILE__, __LINE__, "class %s is not defined", name);
63
- if (Qnil != error_class) {
64
- pi->err_class = error_class;
65
- }
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
+ }
66
62
  }
67
63
  return clas;
68
64
  }
69
65
 
70
66
  VALUE
71
67
  oj_name2class(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class) {
72
- VALUE clas;
73
- VALUE *slot;
74
-
75
68
  if (No == pi->options.class_cache) {
76
- return resolve_classpath(pi, name, len, auto_define, error_class);
69
+ return resolve_classpath(pi, name, len, auto_define, error_class);
77
70
  }
78
- #ifdef HAVE_PTHREAD_MUTEX_INIT
79
- pthread_mutex_lock(&oj_cache_mutex);
80
- #else
81
- rb_mutex_lock(oj_cache_mutex);
82
- #endif
83
- if (Qnil == (clas = oj_class_hash_get(name, len, &slot))) {
84
- if (Qundef != (clas = resolve_classpath(pi, name, len, auto_define, error_class))) {
85
- *slot = clas;
86
- }
87
- }
88
- #ifdef HAVE_PTHREAD_MUTEX_INIT
89
- pthread_mutex_unlock(&oj_cache_mutex);
90
- #else
91
- rb_mutex_unlock(oj_cache_mutex);
92
- #endif
93
- return clas;
71
+ return oj_class_intern(name, len, true, pi, auto_define, error_class);
94
72
  }
95
73
 
96
74
  VALUE
97
75
  oj_name2struct(ParseInfo pi, VALUE nameVal, VALUE error_class) {
98
- size_t len = RSTRING_LEN(nameVal);
99
- const char *str = StringValuePtr(nameVal);
76
+ size_t len = RSTRING_LEN(nameVal);
77
+ const char *str = StringValuePtr(nameVal);
100
78
 
101
79
  return resolve_classpath(pi, str, len, 0, error_class);
102
80
  }
data/ext/oj/resolve.h CHANGED
@@ -1,14 +1,12 @@
1
- /* resolve.h
2
- * Copyright (c) 2011, Peter Ohler
3
- * All rights reserved.
4
- */
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.
5
3
 
6
4
  #ifndef OJ_RESOLVE_H
7
5
  #define OJ_RESOLVE_H
8
6
 
9
7
  #include "ruby.h"
10
8
 
11
- extern VALUE oj_name2class(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class);
12
- 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);
13
11
 
14
12
  #endif /* OJ_RESOLVE_H */
data/ext/oj/rxclass.c CHANGED
@@ -1,79 +1,77 @@
1
- /* rxclass.c
2
- * Copyright (c) 2017, Peter Ohler
3
- * All rights reserved.
4
- */
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.
5
3
 
6
- #include <sys/types.h>
7
- #include <stdlib.h>
8
4
  #include <errno.h>
9
- #include <string.h>
10
5
  #include <stdio.h>
6
+ #include <stdlib.h>
7
+ #include <string.h>
8
+ #include <sys/types.h>
11
9
  #if !IS_WINDOWS
12
10
  #include <regex.h>
13
11
  #endif
14
12
 
13
+ #include "mem.h"
15
14
  #include "rxclass.h"
16
15
 
17
16
  typedef struct _rxC {
18
- struct _rxC *next;
19
- VALUE rrx;
17
+ struct _rxC *next;
18
+ VALUE rrx;
20
19
  #if !IS_WINDOWS
21
- regex_t rx;
20
+ regex_t rx;
22
21
  #endif
23
- VALUE clas;
24
- char src[256];
22
+ VALUE clas;
23
+ char src[256];
25
24
  } *RxC;
26
25
 
27
- void
28
- oj_rxclass_init(RxClass rc) {
26
+ void oj_rxclass_init(RxClass rc) {
29
27
  *rc->err = '\0';
30
28
  rc->head = NULL;
31
29
  rc->tail = NULL;
32
30
  }
33
31
 
34
- void
35
- oj_rxclass_cleanup(RxClass rc) {
36
- RxC rxc;
32
+ void oj_rxclass_cleanup(RxClass rc) {
33
+ RxC rxc;
37
34
 
38
35
  while (NULL != (rxc = rc->head)) {
39
- rc->head = rc->head->next;
36
+ rc->head = rc->head->next;
40
37
  #if !IS_WINDOWS
41
- if (Qnil == rxc->rrx) {
42
- regfree(&rxc->rx);
43
- }
44
- xfree(rxc);
38
+ if (Qnil == rxc->rrx) {
39
+ regfree(&rxc->rx);
40
+ }
41
+ OJ_R_FREE(rxc);
45
42
  #endif
46
43
  }
47
44
  }
48
45
 
49
- void
50
- oj_rxclass_rappend(RxClass rc, VALUE rx, VALUE clas) {
51
- 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);
52
48
 
53
49
  memset(rxc, 0, sizeof(struct _rxC));
54
- rxc->rrx = rx;
50
+ rxc->rrx = rx;
55
51
  rxc->clas = clas;
56
52
  if (NULL == rc->tail) {
57
- rc->head = rxc;
53
+ rc->head = rxc;
58
54
  } else {
59
- rc->tail->next = rxc;
55
+ rc->tail->next = rxc;
60
56
  }
61
57
  rc->tail = rxc;
62
58
  }
63
59
 
64
60
  // Attempt to compile the expression. If it fails populate the error code..
65
- int
66
- oj_rxclass_append(RxClass rc, const char *expr, VALUE clas) {
67
- RxC rxc;
61
+ int oj_rxclass_append(RxClass rc, const char *expr, VALUE clas) {
62
+ RxC rxc;
68
63
  #if !IS_WINDOWS
69
- int err;
70
- int flags = 0;
64
+ int err;
65
+ int flags = 0;
71
66
  #endif
72
67
  if (sizeof(rxc->src) <= strlen(expr)) {
73
- snprintf(rc->err, sizeof(rc->err), "expressions must be less than %lu characters", (unsigned long)sizeof(rxc->src));
74
- 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;
75
73
  }
76
- rxc = ALLOC_N(struct _rxC, 1);
74
+ rxc = OJ_R_ALLOC_N(struct _rxC, 1);
77
75
  rxc->next = 0;
78
76
  rxc->clas = clas;
79
77
 
@@ -82,15 +80,15 @@ oj_rxclass_append(RxClass rc, const char *expr, VALUE clas) {
82
80
  #else
83
81
  rxc->rrx = Qnil;
84
82
  if (0 != (err = regcomp(&rxc->rx, expr, flags))) {
85
- regerror(err, &rxc->rx, rc->err, sizeof(rc->err));
86
- free(rxc);
87
- return err;
83
+ regerror(err, &rxc->rx, rc->err, sizeof(rc->err));
84
+ OJ_FREE(rxc);
85
+ return err;
88
86
  }
89
87
  #endif
90
88
  if (NULL == rc->tail) {
91
- rc->head = rxc;
89
+ rc->head = rxc;
92
90
  } else {
93
- rc->tail->next = rxc;
91
+ rc->tail->next = rxc;
94
92
  }
95
93
  rc->tail = rxc;
96
94
 
@@ -99,49 +97,48 @@ oj_rxclass_append(RxClass rc, const char *expr, VALUE clas) {
99
97
 
100
98
  VALUE
101
99
  oj_rxclass_match(RxClass rc, const char *str, int len) {
102
- RxC rxc;
103
- char buf[4096];
104
-
100
+ RxC rxc;
101
+ char buf[4096];
102
+
105
103
  for (rxc = rc->head; NULL != rxc; rxc = rxc->next) {
106
- if (Qnil != rxc->rrx) {
107
- // Must use a valiabel for this to work.
108
- volatile VALUE rstr = rb_str_new(str, len);
109
-
110
- //if (Qtrue == rb_funcall(rxc->rrx, rb_intern("match?"), 1, rstr)) {
111
- if (Qnil != rb_funcall(rxc->rrx, rb_intern("match"), 1, rstr)) {
112
- return rxc->clas;
113
- }
114
- } 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)) {
115
113
  #if !IS_WINDOWS
116
- // string is not \0 terminated so copy and atempt a match
117
- memcpy(buf, str, len);
118
- buf[len] = '\0';
119
- if (0 == regexec(&rxc->rx, buf, 0, NULL, 0)) { // match
120
- return rxc->clas;
121
- }
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
+ }
122
120
  #endif
123
- } else {
124
- // TBD allocate a larger buffer and attempt
125
- }
121
+ } else {
122
+ // TBD allocate a larger buffer and attempt
123
+ }
126
124
  }
127
125
  return Qnil;
128
126
  }
129
127
 
130
- void
131
- oj_rxclass_copy(RxClass src, RxClass dest) {
128
+ void oj_rxclass_copy(RxClass src, RxClass dest) {
132
129
  dest->head = NULL;
133
130
  dest->tail = NULL;
134
131
  if (NULL != src->head) {
135
- RxC rxc;
132
+ RxC rxc;
136
133
 
137
- for (rxc = src->head; NULL != rxc; rxc = rxc->next) {
138
- if (Qnil != rxc->rrx) {
139
- oj_rxclass_rappend(dest, rxc->rrx, rxc->clas);
140
- } 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 {
141
138
  #if !IS_WINDOWS
142
- oj_rxclass_append(dest, rxc->src, rxc->clas);
139
+ oj_rxclass_append(dest, rxc->src, rxc->clas);
143
140
  #endif
144
- }
145
- }
141
+ }
142
+ }
146
143
  }
147
144
  }
data/ext/oj/rxclass.h CHANGED
@@ -1,27 +1,26 @@
1
- /* rxclass.h
2
- * Copyright (c) 2017, Peter Ohler
3
- * All rights reserved.
4
- */
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.
5
3
 
6
4
  #ifndef OJ_RXCLASS_H
7
5
  #define OJ_RXCLASS_H
8
6
 
9
7
  #include <stdbool.h>
8
+
10
9
  #include "ruby.h"
11
10
 
12
11
  struct _rxC;
13
12
 
14
13
  typedef struct _rxClass {
15
- struct _rxC *head;
16
- struct _rxC *tail;
17
- char err[128];
14
+ struct _rxC *head;
15
+ struct _rxC *tail;
16
+ char err[128];
18
17
  } *RxClass;
19
18
 
20
- extern void oj_rxclass_init(RxClass rc);
21
- extern void oj_rxclass_cleanup(RxClass rc);
22
- extern int oj_rxclass_append(RxClass rc, const char *expr, VALUE clas);
23
- extern VALUE oj_rxclass_match(RxClass rc, const char *str, int len);
24
- extern void oj_rxclass_copy(RxClass src, RxClass dest);
25
- 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);
26
25
 
27
26
  #endif /* OJ_RXCLASS_H */