ox 2.14.12 → 2.14.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/ext/ox/hash_load.c +1 -1
- data/ext/ox/sax.c +6 -4
- data/ext/ox/sax_stack.h +16 -2
- data/lib/ox/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: e05d933efc3ea58f72d9c9d9851d6dab608613f7614a09fa6b4dbed5b998b094
|
4
|
+
data.tar.gz: 9f85899f321b465fb0cb3b65e1a39d0182b9171505b04758bae30e24a4c1f76d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a19ec4e471fd35baba036fcdb01bc1d01820a0aac236a94d4da4cf10fde4da49a2c6cd144c1407ba42605b50c1239587bcee993aba5edb36219f65577742173b
|
7
|
+
data.tar.gz: dd1839eab2fef06690186839f81a17ed364c4713e9029960b81caf66ddc818b8892429eb60c1a0673de81ef53398946a5da89f2775078ad5fe85c4fbb2386b38
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
All changes to the Ox gem are documented here. Releases follow semantic versioning.
|
4
4
|
|
5
|
+
## [2.14.14] - 2023-01-26
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
- Change free to xfree on ruby alloced memory.
|
10
|
+
|
11
|
+
## [2.14.13] - 2023-01-16
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
|
15
|
+
- Fixed the intern cache to handle symbol memory changes.
|
16
|
+
|
5
17
|
## [2.14.12] - 2022-12-27
|
6
18
|
|
7
19
|
### Fixed
|
data/ext/ox/hash_load.c
CHANGED
@@ -35,7 +35,7 @@ mark_value(PInfo pi, VALUE val) {
|
|
35
35
|
pi->mark_size = MARK_INC;
|
36
36
|
} else if (pi->mark_size <= pi->mark_cnt) {
|
37
37
|
pi->mark_size += MARK_INC;
|
38
|
-
|
38
|
+
REALLOC_N(pi->marked, VALUE, pi->mark_size);
|
39
39
|
}
|
40
40
|
pi->marked[pi->mark_cnt] = val;
|
41
41
|
pi->mark_cnt++;
|
data/ext/ox/sax.c
CHANGED
@@ -762,6 +762,7 @@ CB:
|
|
762
762
|
*/
|
763
763
|
static char read_element_start(SaxDrive dr) {
|
764
764
|
const char *ename = 0;
|
765
|
+
size_t nlen;
|
765
766
|
volatile VALUE name = Qnil;
|
766
767
|
char c;
|
767
768
|
int closed;
|
@@ -790,6 +791,7 @@ static char read_element_start(SaxDrive dr) {
|
|
790
791
|
0 == strcasecmp("html", dr->buf.str)) {
|
791
792
|
dr->options.hints = ox_hints_html();
|
792
793
|
}
|
794
|
+
nlen = dr->buf.tail - dr->buf.str - 1;
|
793
795
|
if (NULL != dr->options.hints) {
|
794
796
|
hint_clear_empty(dr);
|
795
797
|
h = ox_hint_find(dr->options.hints, dr->buf.str);
|
@@ -810,7 +812,7 @@ static char read_element_start(SaxDrive dr) {
|
|
810
812
|
if (rb_respond_to(dr->handler, ox_abort_id)) {
|
811
813
|
VALUE args[1];
|
812
814
|
|
813
|
-
args[0] = str2sym(dr, dr->buf.str,
|
815
|
+
args[0] = str2sym(dr, dr->buf.str, nlen, NULL);
|
814
816
|
rb_funcall2(dr->handler, ox_abort_id, 1, args);
|
815
817
|
}
|
816
818
|
dr->abort = true;
|
@@ -861,7 +863,7 @@ static char read_element_start(SaxDrive dr) {
|
|
861
863
|
}
|
862
864
|
}
|
863
865
|
}
|
864
|
-
name = str2sym(dr, dr->buf.str,
|
866
|
+
name = str2sym(dr, dr->buf.str, nlen, &ename);
|
865
867
|
if (dr->has_start_element && 0 >= dr->blocked &&
|
866
868
|
(NULL == h || ActiveOverlay == h->overlay || NestOverlay == h->overlay)) {
|
867
869
|
VALUE args[1];
|
@@ -894,7 +896,7 @@ static char read_element_start(SaxDrive dr) {
|
|
894
896
|
} else if (stackless) {
|
895
897
|
end_element_cb(dr, name, pos, line, col, h);
|
896
898
|
} else if (NULL != h && h->jump) {
|
897
|
-
stack_push(&dr->stack, ename, name, h);
|
899
|
+
stack_push(&dr->stack, ename, nlen, name, h);
|
898
900
|
if ('>' != c) {
|
899
901
|
ox_sax_drive_error(dr, WRONG_CHAR "element not closed");
|
900
902
|
return c;
|
@@ -902,7 +904,7 @@ static char read_element_start(SaxDrive dr) {
|
|
902
904
|
read_jump(dr, h->name);
|
903
905
|
return '<';
|
904
906
|
} else {
|
905
|
-
stack_push(&dr->stack, ename, name, h);
|
907
|
+
stack_push(&dr->stack, ename, nlen, name, h);
|
906
908
|
}
|
907
909
|
if ('>' != c) {
|
908
910
|
ox_sax_drive_error(dr, WRONG_CHAR "element not closed");
|
data/ext/ox/sax_stack.h
CHANGED
@@ -6,11 +6,16 @@
|
|
6
6
|
#ifndef OX_SAX_STACK_H
|
7
7
|
#define OX_SAX_STACK_H
|
8
8
|
|
9
|
+
#include <stdlib.h>
|
10
|
+
|
11
|
+
#include "intern.h"
|
9
12
|
#include "sax_hint.h"
|
10
13
|
|
11
14
|
#define STACK_INC 32
|
15
|
+
#define NV_BUF_MAX 64
|
12
16
|
|
13
17
|
typedef struct _nv {
|
18
|
+
char name_buf[NV_BUF_MAX];
|
14
19
|
const char *name;
|
15
20
|
VALUE val;
|
16
21
|
int childCnt;
|
@@ -44,7 +49,7 @@ stack_cleanup(NStack stack) {
|
|
44
49
|
}
|
45
50
|
|
46
51
|
inline static void
|
47
|
-
stack_push(NStack stack, const char *name, VALUE val, Hint hint) {
|
52
|
+
stack_push(NStack stack, const char *name, size_t nlen, VALUE val, Hint hint) {
|
48
53
|
if (stack->end <= stack->tail) {
|
49
54
|
size_t len = stack->end - stack->head;
|
50
55
|
size_t toff = stack->tail - stack->head;
|
@@ -58,7 +63,13 @@ stack_push(NStack stack, const char *name, VALUE val, Hint hint) {
|
|
58
63
|
stack->tail = stack->head + toff;
|
59
64
|
stack->end = stack->head + len + STACK_INC;
|
60
65
|
}
|
61
|
-
|
66
|
+
if (NV_BUF_MAX <= nlen) {
|
67
|
+
stack->tail->name = ox_strndup(name, nlen);
|
68
|
+
} else {
|
69
|
+
strncpy(stack->tail->name_buf, name, nlen);
|
70
|
+
stack->tail->name_buf[nlen] = '\0';
|
71
|
+
stack->tail->name = stack->tail->name_buf;
|
72
|
+
}
|
62
73
|
stack->tail->val = val;
|
63
74
|
stack->tail->hint = hint;
|
64
75
|
stack->tail->childCnt = 0;
|
@@ -77,6 +88,9 @@ inline static Nv
|
|
77
88
|
stack_pop(NStack stack) {
|
78
89
|
if (stack->head < stack->tail) {
|
79
90
|
stack->tail--;
|
91
|
+
if (stack->tail->name != stack->tail->name_buf) {
|
92
|
+
xfree((char*)(stack->tail->name));
|
93
|
+
}
|
80
94
|
return stack->tail;
|
81
95
|
}
|
82
96
|
return 0;
|
data/lib/ox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.14.
|
4
|
+
version: 2.14.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: "A fast XML parser and object serializer that uses only standard C lib.\n\nOptimized
|
14
14
|
XML (Ox), as the name implies was written to provide speed optimized\nXML handling.
|