ox 2.14.12 → 2.14.13
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -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: f9742d803f0730d6e9724d0f08809ec291b474beae8e966cf3b9ab3c95e165fa
|
4
|
+
data.tar.gz: 102f6dc50ee242f5a7cbb4e8395aa4004d826679b5b02f0e9734d3e8d206d7ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 754fe3197d3944d4b398ba0334d62bc45d066448885e9a47ac8216c0a292203f273c4f0ab764a3ec4e5e49ebc472282ac89821aa0f03929491c60c659494e02b
|
7
|
+
data.tar.gz: 31f01b2ca8b2440511c9eda13fe590937bfd266173d83befcc81e228c0e8516545a29369755f1575c2e8bdb11aac791e463a397035fafed8e13848a23c8fb255
|
data/CHANGELOG.md
CHANGED
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
|
+
free((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.13
|
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-16 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.
|