oj 3.10.14 → 3.10.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/oj/buf.h +2 -30
- data/ext/oj/cache8.h +1 -29
- data/ext/oj/circarray.c +4 -8
- data/ext/oj/circarray.h +1 -4
- data/ext/oj/code.c +3 -6
- data/ext/oj/code.h +1 -4
- data/ext/oj/compat.c +1 -4
- data/ext/oj/custom.c +1 -4
- data/ext/oj/dump.c +1 -4
- data/ext/oj/dump.h +1 -4
- data/ext/oj/dump_compat.c +1 -4
- data/ext/oj/dump_leaf.c +2 -5
- data/ext/oj/dump_object.c +1 -4
- data/ext/oj/dump_strict.c +1 -4
- data/ext/oj/encode.h +1 -29
- data/ext/oj/err.c +1 -4
- data/ext/oj/err.h +1 -29
- data/ext/oj/fast.c +14 -42
- data/ext/oj/hash.c +4 -32
- data/ext/oj/hash.h +1 -29
- data/ext/oj/hash_test.c +1 -29
- data/ext/oj/mimic_json.c +1 -4
- data/ext/oj/object.c +1 -4
- data/ext/oj/odd.c +1 -4
- data/ext/oj/odd.h +1 -4
- data/ext/oj/oj.c +1 -4
- data/ext/oj/oj.h +1 -4
- data/ext/oj/parse.c +1 -4
- data/ext/oj/parse.h +1 -4
- data/ext/oj/rails.c +1 -4
- data/ext/oj/rails.h +1 -4
- data/ext/oj/reader.c +5 -8
- data/ext/oj/reader.h +2 -5
- data/ext/oj/resolve.c +1 -4
- data/ext/oj/resolve.h +1 -4
- data/ext/oj/rxclass.c +3 -6
- data/ext/oj/rxclass.h +1 -4
- data/ext/oj/saj.c +6 -9
- data/ext/oj/scp.c +1 -4
- data/ext/oj/sparse.c +1 -4
- data/ext/oj/stream_writer.c +4 -9
- data/ext/oj/strict.c +3 -6
- data/ext/oj/string_writer.c +1 -4
- data/ext/oj/trace.c +5 -8
- data/ext/oj/trace.h +1 -4
- data/ext/oj/util.c +1 -1
- data/ext/oj/util.h +1 -1
- data/ext/oj/val_stack.c +1 -29
- data/ext/oj/val_stack.h +1 -29
- data/ext/oj/wab.c +1 -4
- data/lib/oj/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80fcb3a59fb873da369d49ad3962960b159c0de18580de24da0cbc65935e7275
|
4
|
+
data.tar.gz: ddcd3f0b95a5a6cd9658c86fff9063bf6bbbc034091a894e8c3c8dcbd4a82e3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a59ab0a3872261dde24fb06612cbc90fbe6d8b06800d5304ba82ce789c0cdcff88c22477b268a8e1161595f97d8b09c0dcbc6b7b25ea7a9373590734618952c0
|
7
|
+
data.tar.gz: 7a547ff4e19e3ca256762fa5c75598e1aa5cb5bd1a15986a5258b9bdea24be6d4f77d34bfc0d142a061960d30d4b69238bb38b21ebd50095086a99e378eb37e5
|
data/ext/oj/buf.h
CHANGED
@@ -1,32 +1,4 @@
|
|
1
|
-
|
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
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
30
2
|
|
31
3
|
#ifndef OJ_BUF_H
|
32
4
|
#define OJ_BUF_H
|
@@ -78,7 +50,7 @@ buf_append_string(Buf buf, const char *s, size_t slen) {
|
|
78
50
|
memcpy(buf->tail, s, slen);
|
79
51
|
buf->tail += slen;
|
80
52
|
}
|
81
|
-
|
53
|
+
|
82
54
|
inline static void
|
83
55
|
buf_append(Buf buf, char c) {
|
84
56
|
if (buf->end <= buf->tail) {
|
data/ext/oj/cache8.h
CHANGED
@@ -1,32 +1,4 @@
|
|
1
|
-
|
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
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
30
2
|
|
31
3
|
#ifndef OJ_CACHE8_H
|
32
4
|
#define OJ_CACHE8_H
|
data/ext/oj/circarray.c
CHANGED
@@ -1,21 +1,18 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2012, Peter Ohler
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2012 Peter Ohler. All rights reserved.
|
5
2
|
|
6
3
|
#include "circarray.h"
|
7
4
|
|
8
5
|
CircArray
|
9
6
|
oj_circ_array_new() {
|
10
7
|
CircArray ca;
|
11
|
-
|
8
|
+
|
12
9
|
if (0 == (ca = ALLOC(struct _circArray))) {
|
13
10
|
rb_raise(rb_eNoMemError, "not enough memory\n");
|
14
11
|
}
|
15
12
|
ca->objs = ca->obj_array;
|
16
13
|
ca->size = sizeof(ca->obj_array) / sizeof(VALUE);
|
17
14
|
ca->cnt = 0;
|
18
|
-
|
15
|
+
|
19
16
|
return ca;
|
20
17
|
}
|
21
18
|
|
@@ -40,7 +37,7 @@ oj_circ_array_set(CircArray ca, VALUE obj, unsigned long id) {
|
|
40
37
|
rb_raise(rb_eNoMemError, "not enough memory\n");
|
41
38
|
}
|
42
39
|
memcpy(ca->objs, ca->obj_array, sizeof(VALUE) * ca->cnt);
|
43
|
-
} else {
|
40
|
+
} else {
|
44
41
|
REALLOC_N(ca->objs, VALUE, cnt);
|
45
42
|
}
|
46
43
|
ca->size = cnt;
|
@@ -65,4 +62,3 @@ oj_circ_array_get(CircArray ca, unsigned long id) {
|
|
65
62
|
}
|
66
63
|
return obj;
|
67
64
|
}
|
68
|
-
|
data/ext/oj/circarray.h
CHANGED
data/ext/oj/code.c
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2017, Peter Ohler
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2017 Peter Ohler. All rights reserved.
|
5
2
|
|
6
3
|
#include "code.h"
|
7
4
|
#include "dump.h"
|
@@ -140,7 +137,7 @@ oj_code_attrs(VALUE obj, Attr attrs, int depth, Out out, bool with_class) {
|
|
140
137
|
size_t len = strlen(classname);
|
141
138
|
size_t size = d2 * out->indent + 10 + len + out->opts->create_id_len + sep_len;
|
142
139
|
bool no_comma = true;
|
143
|
-
|
140
|
+
|
144
141
|
assure_size(out, size);
|
145
142
|
*out->cur++ = '{';
|
146
143
|
|
@@ -201,7 +198,7 @@ oj_code_attrs(VALUE obj, Attr attrs, int depth, Out out, bool with_class) {
|
|
201
198
|
char *b = buf + sizeof(buf) - 1;
|
202
199
|
int neg = 0;
|
203
200
|
long num = attrs->num;
|
204
|
-
|
201
|
+
|
205
202
|
if (0 > num) {
|
206
203
|
neg = 1;
|
207
204
|
num = -num;
|
data/ext/oj/code.h
CHANGED
data/ext/oj/compat.c
CHANGED
data/ext/oj/custom.c
CHANGED
data/ext/oj/dump.c
CHANGED
data/ext/oj/dump.h
CHANGED
data/ext/oj/dump_compat.c
CHANGED
data/ext/oj/dump_leaf.c
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2012, 2017, Peter Ohler
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2012, 2017 Peter Ohler. All rights reserved.
|
5
2
|
|
6
3
|
#include <errno.h>
|
7
4
|
|
@@ -15,7 +12,7 @@ grow(Out out, size_t len) {
|
|
15
12
|
size_t size = out->end - out->buf;
|
16
13
|
long pos = out->cur - out->buf;
|
17
14
|
char *buf;
|
18
|
-
|
15
|
+
|
19
16
|
size *= 2;
|
20
17
|
if (size <= len * 2 + pos) {
|
21
18
|
size += len;
|
data/ext/oj/dump_object.c
CHANGED
data/ext/oj/dump_strict.c
CHANGED
data/ext/oj/encode.h
CHANGED
@@ -1,32 +1,4 @@
|
|
1
|
-
|
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
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
30
2
|
|
31
3
|
#ifndef OJ_ENCODE_H
|
32
4
|
#define OJ_ENCODE_H
|
data/ext/oj/err.c
CHANGED
data/ext/oj/err.h
CHANGED
@@ -1,32 +1,4 @@
|
|
1
|
-
|
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
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
30
2
|
|
31
3
|
#ifndef OJ_ERR_H
|
32
4
|
#define OJ_ERR_H
|
data/ext/oj/fast.c
CHANGED
@@ -1,32 +1,4 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2012, 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
|
-
*/
|
1
|
+
// Copyright (c) 2012 Peter Ohler. All rights reserved.
|
30
2
|
|
31
3
|
#if !IS_WINDOWS
|
32
4
|
#include <sys/resource.h> // for getrlimit() on linux
|
@@ -121,7 +93,7 @@ VALUE oj_doc_class = Qundef;
|
|
121
93
|
#ifndef HAVE_STPCPY
|
122
94
|
char *stpcpy(char *dest, const char *src) {
|
123
95
|
size_t cnt = strlen(src);
|
124
|
-
|
96
|
+
|
125
97
|
strcpy(dest, src);
|
126
98
|
|
127
99
|
return dest + cnt;
|
@@ -322,7 +294,7 @@ leaf_fixnum_value(Leaf leaf) {
|
|
322
294
|
int64_t n = 0;
|
323
295
|
int neg = 0;
|
324
296
|
int big = 0;
|
325
|
-
|
297
|
+
|
326
298
|
if ('-' == *s) {
|
327
299
|
s++;
|
328
300
|
neg = 1;
|
@@ -337,7 +309,7 @@ leaf_fixnum_value(Leaf leaf) {
|
|
337
309
|
}
|
338
310
|
if (big) {
|
339
311
|
char c = *s;
|
340
|
-
|
312
|
+
|
341
313
|
*s = '\0';
|
342
314
|
leaf->value = rb_cstr_to_inum(leaf->str, 10, 0);
|
343
315
|
*s = c;
|
@@ -672,7 +644,7 @@ read_quoted_value(ParseInfo pi) {
|
|
672
644
|
char *value = 0;
|
673
645
|
char *h = pi->s; // head
|
674
646
|
char *t = h; // tail
|
675
|
-
|
647
|
+
|
676
648
|
h++; // skip quote character
|
677
649
|
t++;
|
678
650
|
value = h;
|
@@ -805,7 +777,7 @@ static void
|
|
805
777
|
mark_doc(void *ptr) {
|
806
778
|
if (NULL != ptr) {
|
807
779
|
Doc doc = (Doc)ptr;
|
808
|
-
|
780
|
+
|
809
781
|
rb_gc_mark(doc->self);
|
810
782
|
mark_leaf(doc->data);
|
811
783
|
}
|
@@ -820,7 +792,7 @@ parse_json(VALUE clas, char *json, bool given, bool allocated) {
|
|
820
792
|
volatile VALUE self;
|
821
793
|
|
822
794
|
// TBD are both needed? is stack allocation ever needed?
|
823
|
-
|
795
|
+
|
824
796
|
if (given) {
|
825
797
|
doc = ALLOCA_N(struct _doc, 1);
|
826
798
|
} else {
|
@@ -1226,7 +1198,7 @@ doc_open_file(VALUE clas, VALUE filename) {
|
|
1226
1198
|
fseek(f, 0, SEEK_SET);
|
1227
1199
|
if (len != fread(json, 1, len, f)) {
|
1228
1200
|
fclose(f);
|
1229
|
-
rb_raise(rb_const_get_at(Oj, rb_intern("LoadError")),
|
1201
|
+
rb_raise(rb_const_get_at(Oj, rb_intern("LoadError")),
|
1230
1202
|
"Failed to read %lu bytes from %s.", (unsigned long)len, path);
|
1231
1203
|
}
|
1232
1204
|
fclose(f);
|
@@ -1575,7 +1547,7 @@ doc_each_child(int argc, VALUE *argv, VALUE self) {
|
|
1575
1547
|
* result
|
1576
1548
|
* }
|
1577
1549
|
* #=> [3, 2, 1]
|
1578
|
-
*
|
1550
|
+
*
|
1579
1551
|
* Oj::Doc.open('[3,[2,1]]') { |doc|
|
1580
1552
|
* result = []
|
1581
1553
|
* doc.each_value('/2') { |v| result << v }
|
@@ -1708,21 +1680,21 @@ doc_not_implemented(VALUE self) {
|
|
1708
1680
|
* extracted. Once the document is closed the document can not longer be
|
1709
1681
|
* accessed. This allows the parsing and data extraction to be extremely fast
|
1710
1682
|
* compared to other JSON parses.
|
1711
|
-
*
|
1683
|
+
*
|
1712
1684
|
* An Oj::Doc class is not created directly but the _open()_ class method is
|
1713
1685
|
* used to open a document and the yield parameter to the block of the #open()
|
1714
1686
|
* call is the Doc instance. The Doc instance can be moved across, up, and
|
1715
1687
|
* down the JSON document. At each element the data associated with the
|
1716
1688
|
* element can be extracted. It is also possible to just provide a path to the
|
1717
1689
|
* data to be extracted and retrieve the data in that manner.
|
1718
|
-
*
|
1690
|
+
*
|
1719
1691
|
* For many of the methods a path is used to describe the location of an
|
1720
1692
|
* element. Paths follow a subset of the XPath syntax. The slash ('/')
|
1721
1693
|
* character is the separator. Each step in the path identifies the next
|
1722
1694
|
* branch to take through the document. A JSON object will expect a key string
|
1723
1695
|
* while an array will expect a positive index. A .. step indicates a move up
|
1724
1696
|
* the JSON document.
|
1725
|
-
*
|
1697
|
+
*
|
1726
1698
|
* @example
|
1727
1699
|
* json = %{[
|
1728
1700
|
* {
|
@@ -1736,12 +1708,12 @@ doc_not_implemented(VALUE self) {
|
|
1736
1708
|
* ]}
|
1737
1709
|
* # move and get value
|
1738
1710
|
* Oj::Doc.open(json) do |doc|
|
1739
|
-
* doc.move('/1/two')
|
1711
|
+
* doc.move('/1/two')
|
1740
1712
|
* # doc location is now at the 'two' element of the hash that is the first element of the array.
|
1741
1713
|
* doc.fetch()
|
1742
1714
|
* end
|
1743
1715
|
* #=> 2
|
1744
|
-
*
|
1716
|
+
*
|
1745
1717
|
* # Now try again using a path to Oj::Doc.fetch() directly and not using a block.
|
1746
1718
|
* doc = Oj::Doc.open(json)
|
1747
1719
|
* doc.fetch('/2/three') #=> 3
|
data/ext/oj/hash.c
CHANGED
@@ -1,32 +1,4 @@
|
|
1
|
-
|
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
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
30
2
|
|
31
3
|
#include "hash.h"
|
32
4
|
#include <stdint.h>
|
@@ -85,7 +57,7 @@ hash_calc(const uint8_t *key, size_t len) {
|
|
85
57
|
h ^= h >> 13;
|
86
58
|
h *= M;
|
87
59
|
h ^= h >> 15;
|
88
|
-
|
60
|
+
|
89
61
|
return h;
|
90
62
|
}
|
91
63
|
|
@@ -115,7 +87,7 @@ hash_get(Hash hash, const char *key, size_t len, VALUE **slotp, VALUE def_value)
|
|
115
87
|
if (0 != slotp) {
|
116
88
|
if (0 != bucket->key) {
|
117
89
|
KeyVal b = ALLOC(struct _keyVal);
|
118
|
-
|
90
|
+
|
119
91
|
b->next = 0;
|
120
92
|
bucket->next = b;
|
121
93
|
bucket = b;
|
@@ -155,7 +127,7 @@ oj_attr_hash_get(const char *key, size_t len, ID **slotp) {
|
|
155
127
|
char*
|
156
128
|
oj_strndup(const char *s, size_t len) {
|
157
129
|
char *d = ALLOC_N(char, len + 1);
|
158
|
-
|
130
|
+
|
159
131
|
memcpy(d, s, len);
|
160
132
|
d[len] = '\0';
|
161
133
|
|
data/ext/oj/hash.h
CHANGED
@@ -1,32 +1,4 @@
|
|
1
|
-
|
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
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
30
2
|
|
31
3
|
#ifndef OJ_HASH_H
|
32
4
|
#define OJ_HASH_H
|
data/ext/oj/hash_test.c
CHANGED
@@ -1,32 +1,4 @@
|
|
1
|
-
|
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
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
30
2
|
|
31
3
|
// if windows, comment out the whole file. It's only a performance test.
|
32
4
|
#ifndef _WIN32
|
data/ext/oj/mimic_json.c
CHANGED
data/ext/oj/object.c
CHANGED
data/ext/oj/odd.c
CHANGED
data/ext/oj/odd.h
CHANGED
data/ext/oj/oj.c
CHANGED
data/ext/oj/oj.h
CHANGED
data/ext/oj/parse.c
CHANGED
data/ext/oj/parse.h
CHANGED
data/ext/oj/rails.c
CHANGED
data/ext/oj/rails.h
CHANGED
data/ext/oj/reader.c
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2011, Peter Ohler
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
5
2
|
|
6
3
|
#include <stdlib.h>
|
7
4
|
#include <errno.h>
|
@@ -9,7 +6,7 @@
|
|
9
6
|
#include <strings.h>
|
10
7
|
#include <sys/types.h>
|
11
8
|
#if NEEDS_UIO
|
12
|
-
#include <sys/uio.h>
|
9
|
+
#include <sys/uio.h>
|
13
10
|
#endif
|
14
11
|
#include <unistd.h>
|
15
12
|
#include <time.h>
|
@@ -78,13 +75,13 @@ oj_reader_init(Reader reader, VALUE io, int fd, bool to_s) {
|
|
78
75
|
reader->io = io;
|
79
76
|
} else if (to_s) {
|
80
77
|
volatile VALUE rstr = rb_funcall(io, oj_to_s_id, 0);
|
81
|
-
|
78
|
+
|
82
79
|
reader->read_func = 0;
|
83
80
|
reader->in_str = StringValuePtr(rstr);
|
84
81
|
reader->head = (char*)reader->in_str;
|
85
82
|
reader->tail = reader->head;
|
86
83
|
reader->read_end = reader->head + RSTRING_LEN(rstr);
|
87
|
-
} else {
|
84
|
+
} else {
|
88
85
|
rb_raise(rb_eArgError, "parser io argument must be a String or respond to readpartial() or read().\n");
|
89
86
|
}
|
90
87
|
}
|
@@ -107,7 +104,7 @@ oj_reader_read(Reader reader) {
|
|
107
104
|
if (0 >= shift) { /* no space left so allocate more */
|
108
105
|
const char *old = reader->head;
|
109
106
|
size_t size = reader->end - reader->head + BUF_PAD;
|
110
|
-
|
107
|
+
|
111
108
|
if (reader->head == reader->base) {
|
112
109
|
reader->head = ALLOC_N(char, size * 2);
|
113
110
|
memcpy((char*)reader->head, old, size);
|
data/ext/oj/reader.h
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2011, Peter Ohler
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
5
2
|
|
6
3
|
#ifndef OJ_READER_H
|
7
4
|
#define OJ_READER_H
|
@@ -43,7 +40,7 @@ reader_get(Reader reader) {
|
|
43
40
|
}
|
44
41
|
reader->col++;
|
45
42
|
reader->pos++;
|
46
|
-
|
43
|
+
|
47
44
|
return *reader->tail++;
|
48
45
|
}
|
49
46
|
|
data/ext/oj/resolve.c
CHANGED
data/ext/oj/resolve.h
CHANGED
data/ext/oj/rxclass.c
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2017, Peter Ohler
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2017 Peter Ohler. All rights reserved.
|
5
2
|
|
6
3
|
#include <sys/types.h>
|
7
4
|
#include <stdlib.h>
|
@@ -101,12 +98,12 @@ VALUE
|
|
101
98
|
oj_rxclass_match(RxClass rc, const char *str, int len) {
|
102
99
|
RxC rxc;
|
103
100
|
char buf[4096];
|
104
|
-
|
101
|
+
|
105
102
|
for (rxc = rc->head; NULL != rxc; rxc = rxc->next) {
|
106
103
|
if (Qnil != rxc->rrx) {
|
107
104
|
// Must use a valiabel for this to work.
|
108
105
|
volatile VALUE rstr = rb_str_new(str, len);
|
109
|
-
|
106
|
+
|
110
107
|
//if (Qtrue == rb_funcall(rxc->rrx, rb_intern("match?"), 1, rstr)) {
|
111
108
|
if (Qnil != rb_funcall(rxc->rrx, rb_intern("match"), 1, rstr)) {
|
112
109
|
return rxc->clas;
|
data/ext/oj/rxclass.h
CHANGED
data/ext/oj/saj.c
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2012, Peter Ohler
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2012 Peter Ohler. All rights reserved.
|
5
2
|
|
6
3
|
#if !IS_WINDOWS
|
7
4
|
#include <sys/resource.h> /* for getrlimit() on linux */
|
@@ -213,7 +210,7 @@ read_next(ParseInfo pi, const char *key) {
|
|
213
210
|
static void
|
214
211
|
read_hash(ParseInfo pi, const char *key) {
|
215
212
|
const char *ks;
|
216
|
-
|
213
|
+
|
217
214
|
if (pi->has_hash_start) {
|
218
215
|
call_no_value(pi->handler, oj_hash_start_id, key);
|
219
216
|
}
|
@@ -378,7 +375,7 @@ read_num(ParseInfo pi, const char *key) {
|
|
378
375
|
if (0 == e && 0 == a && 1 == div) {
|
379
376
|
if (big) {
|
380
377
|
char c = *pi->s;
|
381
|
-
|
378
|
+
|
382
379
|
*pi->s = '\0';
|
383
380
|
if (pi->has_add_value) {
|
384
381
|
call_add_value(pi->handler, rb_funcall(rb_cObject, oj_bigdecimal_id, 1, rb_str_new2(start)), key);
|
@@ -396,7 +393,7 @@ read_num(ParseInfo pi, const char *key) {
|
|
396
393
|
} else { /* decimal */
|
397
394
|
if (big) {
|
398
395
|
char c = *pi->s;
|
399
|
-
|
396
|
+
|
400
397
|
*pi->s = '\0';
|
401
398
|
if (pi->has_add_value) {
|
402
399
|
call_add_value(pi->handler, rb_funcall(rb_cObject, oj_bigdecimal_id, 1, rb_str_new2(start)), key);
|
@@ -541,7 +538,7 @@ read_quoted_value(ParseInfo pi) {
|
|
541
538
|
char *h = pi->s; /* head */
|
542
539
|
char *t = h; /* tail */
|
543
540
|
uint32_t code;
|
544
|
-
|
541
|
+
|
545
542
|
h++; /* skip quote character */
|
546
543
|
t++;
|
547
544
|
value = h;
|
@@ -679,7 +676,7 @@ oj_saj_parse(int argc, VALUE *argv, VALUE self) {
|
|
679
676
|
} else {
|
680
677
|
VALUE clas = rb_obj_class(input);
|
681
678
|
volatile VALUE s;
|
682
|
-
|
679
|
+
|
683
680
|
if (oj_stringio_class == clas) {
|
684
681
|
s = rb_funcall2(input, oj_string_id, 0, 0);
|
685
682
|
len = RSTRING_LEN(s) + 1;
|
data/ext/oj/scp.c
CHANGED
data/ext/oj/sparse.c
CHANGED
data/ext/oj/stream_writer.c
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2012, 2017, Peter Ohler
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2012, 2017 Peter Ohler. All rights reserved.
|
5
2
|
|
6
3
|
#include <errno.h>
|
7
4
|
|
@@ -86,7 +83,7 @@ stream_writer_new(int argc, VALUE *argv, VALUE self) {
|
|
86
83
|
#if !IS_WINDOWS
|
87
84
|
VALUE s;
|
88
85
|
#endif
|
89
|
-
|
86
|
+
|
90
87
|
if (oj_stringio_class == clas) {
|
91
88
|
type = STRING_IO;
|
92
89
|
#if !IS_WINDOWS
|
@@ -107,7 +104,7 @@ stream_writer_new(int argc, VALUE *argv, VALUE self) {
|
|
107
104
|
|
108
105
|
if (Qundef == buffer_size_sym) {
|
109
106
|
buffer_size_sym = ID2SYM(rb_intern("buffer_size")); rb_gc_register_address(&buffer_size_sym);
|
110
|
-
|
107
|
+
|
111
108
|
}
|
112
109
|
if (Qnil != (v = rb_hash_lookup(argv[1], buffer_size_sym))) {
|
113
110
|
#ifdef RUBY_INTEGER_UNIFICATION
|
@@ -340,7 +337,7 @@ stream_writer_flush(VALUE self) {
|
|
340
337
|
}
|
341
338
|
|
342
339
|
/* Document-class: Oj::StreamWriter
|
343
|
-
*
|
340
|
+
*
|
344
341
|
* Supports building a JSON document one element at a time. Build the IO stream
|
345
342
|
* document by pushing values into the document. Pushing an array or an object
|
346
343
|
* will create that element in the JSON document and subsequent pushes will add
|
@@ -359,5 +356,3 @@ oj_stream_writer_init() {
|
|
359
356
|
rb_define_method(oj_stream_writer_class, "pop_all", stream_writer_pop_all, 0);
|
360
357
|
rb_define_method(oj_stream_writer_class, "flush", stream_writer_flush, 0);
|
361
358
|
}
|
362
|
-
|
363
|
-
|
data/ext/oj/strict.c
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2012, Peter Ohler
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2012 Peter Ohler. All rights reserved.
|
5
2
|
|
6
3
|
#include <stdlib.h>
|
7
4
|
#include <stdio.h>
|
@@ -102,7 +99,7 @@ hash_set_cstr(ParseInfo pi, Val parent, const char *str, size_t len, const char
|
|
102
99
|
static void
|
103
100
|
hash_set_num(ParseInfo pi, Val parent, NumInfo ni) {
|
104
101
|
volatile VALUE v;
|
105
|
-
|
102
|
+
|
106
103
|
if (ni->infinity || ni->nan) {
|
107
104
|
oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "not a number or other value");
|
108
105
|
}
|
@@ -143,7 +140,7 @@ array_append_cstr(ParseInfo pi, const char *str, size_t len, const char *orig) {
|
|
143
140
|
static void
|
144
141
|
array_append_num(ParseInfo pi, NumInfo ni) {
|
145
142
|
volatile VALUE v;
|
146
|
-
|
143
|
+
|
147
144
|
if (ni->infinity || ni->nan) {
|
148
145
|
oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "not a number or other value");
|
149
146
|
}
|
data/ext/oj/string_writer.c
CHANGED
data/ext/oj/trace.c
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
* Copyright (c) 2018, Peter Ohler
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2018 Peter Ohler. All rights reserved.
|
5
2
|
|
6
3
|
#include "parse.h"
|
7
4
|
#include "trace.h"
|
@@ -37,7 +34,7 @@ oj_trace_parse_call(const char *func, ParseInfo pi, const char *file, int line,
|
|
37
34
|
char fmt[64];
|
38
35
|
char indent[MAX_INDENT];
|
39
36
|
int depth = (int)(stack_size(&pi->stack) * 2);
|
40
|
-
|
37
|
+
|
41
38
|
fill_indent(indent, depth);
|
42
39
|
sprintf(fmt, "#0:%%13s:%%3d:Oj:-:%%%ds %%s %%s\n", depth);
|
43
40
|
printf(fmt, file, line, indent, func, rb_obj_classname(obj));
|
@@ -48,7 +45,7 @@ oj_trace_parse_in(const char *func, ParseInfo pi, const char *file, int line) {
|
|
48
45
|
char fmt[64];
|
49
46
|
char indent[MAX_INDENT];
|
50
47
|
int depth = (int)(stack_size(&pi->stack) * 2);
|
51
|
-
|
48
|
+
|
52
49
|
fill_indent(indent, depth);
|
53
50
|
sprintf(fmt, "#0:%%13s:%%3d:Oj:}:%%%ds %%s\n", depth);
|
54
51
|
printf(fmt, file, line, indent, func);
|
@@ -61,7 +58,7 @@ oj_trace_parse_hash_end(ParseInfo pi, const char *file, int line) {
|
|
61
58
|
int depth = (int)(stack_size(&pi->stack) * 2 - 2);
|
62
59
|
Val v = stack_peek(&pi->stack);
|
63
60
|
VALUE obj = v->val;
|
64
|
-
|
61
|
+
|
65
62
|
fill_indent(indent, depth);
|
66
63
|
sprintf(fmt, "#0:%%13s:%%3d:Oj:{:%%%ds hash_end %%s\n", depth);
|
67
64
|
printf(fmt, file, line, indent, rb_obj_classname(obj));
|
@@ -72,7 +69,7 @@ oj_trace_parse_array_end(ParseInfo pi, const char *file, int line) {
|
|
72
69
|
char fmt[64];
|
73
70
|
char indent[MAX_INDENT];
|
74
71
|
int depth = (int)(stack_size(&pi->stack) * 2);
|
75
|
-
|
72
|
+
|
76
73
|
fill_indent(indent, depth);
|
77
74
|
sprintf(fmt, "#0:%%13s:%%3d:Oj:{:%%%ds array_ned\n", depth);
|
78
75
|
printf(fmt, file, line, indent);
|
data/ext/oj/trace.h
CHANGED
data/ext/oj/util.c
CHANGED
data/ext/oj/util.h
CHANGED
data/ext/oj/val_stack.c
CHANGED
@@ -1,32 +1,4 @@
|
|
1
|
-
|
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
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
30
2
|
|
31
3
|
#include <string.h>
|
32
4
|
|
data/ext/oj/val_stack.h
CHANGED
@@ -1,32 +1,4 @@
|
|
1
|
-
|
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
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
30
2
|
|
31
3
|
#ifndef OJ_VAL_STACK_H
|
32
4
|
#define OJ_VAL_STACK_H
|
data/ext/oj/wab.c
CHANGED
data/lib/oj/version.rb
CHANGED
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.10.
|
4
|
+
version: 3.10.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|