leptris 1.9.349.0 → 1.9.351.1
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 +26 -0
- data/Rakefile +1 -1
- data/lib/leptris/vendor/aarch64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/aarch64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/arm64-darwin/libleptris.dylib +0 -0
- data/lib/leptris/vendor/ppc64le-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/s390x-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/x86_64-darwin/libleptris.dylib +0 -0
- data/lib/leptris/vendor/x86_64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/x86_64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/plan_value.rb +57 -3
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +80 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/cli/commands/xquery.c +1 -1
- data/vendor-src/libleptris/src/leptris/common/simd_text.c +0 -12
- data/vendor-src/libleptris/src/leptris/common/simd_text.h +19 -0
- data/vendor-src/libleptris/src/leptris/common/simd_text_neon.c +0 -1
- data/vendor-src/libleptris/src/leptris/core.c +2 -5
- data/vendor-src/libleptris/src/leptris/dom/root_doc_map.h +3 -0
- data/vendor-src/libleptris/src/leptris/flat/direct_parse.c +8 -33
- data/vendor-src/libleptris/src/leptris/flat/direct_parse.h +4 -0
- data/vendor-src/libleptris/src/leptris/html/html_parse.c +0 -2
- data/vendor-src/libleptris/src/leptris/leptris.c +6 -41
- data/vendor-src/libleptris/src/leptris/leptris_internal.h +14 -0
- data/vendor-src/libleptris/src/leptris/memory/pool.h +4 -0
- data/vendor-src/libleptris/src/leptris/xpath/evaluator.c +0 -2
- data/vendor-src/libleptris/src/leptris/xpath/evaluator_operators.c +2 -8
- data/vendor-src/libleptris/src/leptris/xpath/functions.c +1 -5
- data/vendor-src/libleptris/src/leptris/xpath/functions.h +29 -0
- data/vendor-src/libleptris/src/leptris/xpath/functions_ext31.c +1 -19
- data/vendor-src/libleptris/src/leptris/xpath/xpath_carrier.h +32 -0
- data/vendor-src/libleptris/src/leptris/xpath/xpath_public.c +1 -15
- data/vendor-src/libleptris/src/leptris/xquery/xquery.c +1 -2
- data/vendor-src/libleptris/src/leptris/xsd/compile.c +158 -3
- data/vendor-src/libleptris/src/leptris/xsd/validate.c +13 -9
- data/vendor-src/libleptris/src/leptris/xsd/xsd_internal.h +8 -0
- data/vendor-src/libleptris/src/leptris/xslt/xslt_exec.c +0 -6
- data/vendor-src/libleptris/src/leptris/xslt/xslt_functions.c +0 -2
- data/vendor-src/libleptris/src/leptris/xslt/xslt_pattern.c +0 -1
- data/vendor-src/libleptris/src/leptris/xslt/xslt_public.c +1 -2
- data/vendor-src/libleptris/test/xquery/test_xquery.cpp +1 -1
- data/vendor-src/libleptris/test/xsd/libxml2-cases/fwd_ref_ext/lib/base.xsd +23 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/fwd_ref_ext/lib/more.xsd +8 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/fwd_ref_ext/root.xsd +10 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/fwd_ref_ext/sub/wrap.xsd +3 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/ns_simple_collision/m.xsd +14 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/ns_simple_collision/w.xsd +14 -0
- data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +70 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f8917a10f31ece6b7db4f4d0efde78c20ed20cd290acbee484a224c8223bfaee
|
|
4
|
+
data.tar.gz: 49efc157d1e96a0928dca5c3cdd1c2bf2e13d9df8bba9a0604d5b43e1a0c93a2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9db06a78a78aef2646e60d5a60d78a93f859696dddf36ab1dd5ecf3cb602cb16c24624bc72a8f4375fd3932fab8f39a2286c2dab04337eecd73adb2fd35db2b8
|
|
7
|
+
data.tar.gz: abf382af7adff1575e63d9b6db69e1a0fd79b5317678ff8f72299430d43cc8fa046219f24aa073c3ee4baad0db7b3536d37383020a57b54ce639e740f21e373d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
## [1.9.351.0] - 2026-10-14
|
|
2
|
+
|
|
3
|
+
### Fixed — engine sync (libleptris 1.9.350/1.9.351)
|
|
4
|
+
|
|
5
|
+
- **Chain-compiled XSD: forward-referenced extension bases fold
|
|
6
|
+
after the schema merges, subfiles resolve their own relative
|
|
7
|
+
schemaLocations, and attribute types resolve (ns, name)-first
|
|
8
|
+
(leptris-ruby#440; libleptris 1.9.350, PR leptris/leptris#1679)**:
|
|
9
|
+
the corpus-stuck-at-8 family. The engine's visited memo (#1644)
|
|
10
|
+
stopped each schema unit being captured twice and unmasked three
|
|
11
|
+
latent defects: the extension fold ran at capture time (a base
|
|
12
|
+
defined after its derived type — CT_TcPr -> CT_TcPrInner —
|
|
13
|
+
silently dropped), a subfile's own schemaLocations resolved
|
|
14
|
+
against the COMPILED file's directory (wml.xsd's same-dir
|
|
15
|
+
shared-*.xsd imports vanished), and attribute type names resolved
|
|
16
|
+
by bare local name (wml's ST_Jc shadowed shared-math's, so
|
|
17
|
+
m:defJc val="centerGroup" failed). Pinned through the binding API
|
|
18
|
+
in spec/xml/xsd_chain_shapes_spec.rb (tempdir chain trees — no
|
|
19
|
+
vendored corpus needed).
|
|
20
|
+
- **GCC LTO carrier link (#1681, libleptris 1.9.350/1.9.351)**:
|
|
21
|
+
ppc64le/s390x/truffleruby legs failed the engine link
|
|
22
|
+
(undefined xpath_carrier_node_of) — fixed engine-side; the
|
|
23
|
+
#445-family legs go green. libleptris 1.9.351 additionally
|
|
24
|
+
removed every function-scope extern (84 sites across 18 TUs), so
|
|
25
|
+
the class cannot recur.
|
|
26
|
+
|
|
1
27
|
## [1.9.346.0] - 2026-10-12
|
|
2
28
|
|
|
3
29
|
### Fixed — engine sync (libleptris 1.9.346)
|
data/Rakefile
CHANGED
|
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
8
8
|
# Pin for `rake compile` and the platform-gem builds. Keep in lockstep
|
|
9
9
|
# with .github/workflows/build.yml (which calls `rake compile`) and the
|
|
10
10
|
# CHANGELOG when libleptris releases.
|
|
11
|
-
LIBLEPTRIS_VERSION = "1.9.
|
|
11
|
+
LIBLEPTRIS_VERSION = "1.9.351"
|
|
12
12
|
# Vendored alongside libleptris for fn:normalize-unicode (TODO
|
|
13
13
|
# .restructure/20): built per platform with a RELOCATABLE @rpath
|
|
14
14
|
# install name, loaded by ffi.rb before libleptris so the
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/leptris/version.rb
CHANGED
|
@@ -168,6 +168,58 @@ class Leptris::XML::PlanValue
|
|
|
168
168
|
Leptris::XML::FFI.leptris_plan_value_attribute(@ptr, wire_name.to_s)
|
|
169
169
|
end
|
|
170
170
|
|
|
171
|
+
# ELEMENT: ALL bound attributes in one FFI crossing (#1670) —
|
|
172
|
+
# { wire_name => value } in the plan's attribute-row order.
|
|
173
|
+
# Mirrors #children_snapshot: enumerating through #attribute costs
|
|
174
|
+
# one crossing per attribute per node; this costs one per node.
|
|
175
|
+
# Empty hash for non-ELEMENT values.
|
|
176
|
+
def attributes_snapshot
|
|
177
|
+
n = Leptris::XML::FFI.leptris_plan_value_attribute_count(@ptr)
|
|
178
|
+
return {}.freeze if n.zero?
|
|
179
|
+
|
|
180
|
+
@counter[0] += 2 # count + the snapshot crossing
|
|
181
|
+
need = Leptris::XML::FFI.leptris_plan_value_attributes_snapshot(
|
|
182
|
+
@ptr, nil, 0, nil, nil, 0, nil
|
|
183
|
+
)
|
|
184
|
+
return {}.freeze if need.zero?
|
|
185
|
+
|
|
186
|
+
cap = need
|
|
187
|
+
loop do
|
|
188
|
+
names = ::FFI::MemoryPointer.new(:char, cap)
|
|
189
|
+
values = ::FFI::MemoryPointer.new(:char, cap)
|
|
190
|
+
name_offsets = ::FFI::MemoryPointer.new(:size_t, n + 1)
|
|
191
|
+
value_offsets = ::FFI::MemoryPointer.new(:size_t, n + 1)
|
|
192
|
+
rc = Leptris::XML::FFI.leptris_plan_value_attributes_snapshot(
|
|
193
|
+
@ptr, names, cap, name_offsets, values, cap, value_offsets
|
|
194
|
+
)
|
|
195
|
+
break attributes_snapshot_build(
|
|
196
|
+
names, name_offsets, values, value_offsets, n
|
|
197
|
+
) if rc.zero?
|
|
198
|
+
|
|
199
|
+
# The sizing call reports the exact capacity, so (size_t)-1
|
|
200
|
+
# here can only mean the tree grew between calls — retry at
|
|
201
|
+
# the doubled guess rather than looping on a stale size.
|
|
202
|
+
raise "attributes snapshot failed" if rc != SIZE_MAX
|
|
203
|
+
|
|
204
|
+
cap *= 2
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def attributes_snapshot_build(names, name_offsets, values,
|
|
209
|
+
value_offsets, n)
|
|
210
|
+
result = {}
|
|
211
|
+
n.times do |i|
|
|
212
|
+
noff = name_offsets.get_uint64(i * SIZE_T_SIZE)
|
|
213
|
+
voff = value_offsets.get_uint64(i * SIZE_T_SIZE)
|
|
214
|
+
# Raw pointer reads come back ASCII-8BIT; the per-name reader
|
|
215
|
+
# attaches UTF8_STRING, so match its encoding contract.
|
|
216
|
+
result[names.get_string(noff).force_encoding(Encoding::UTF_8)] =
|
|
217
|
+
values.get_string(voff).force_encoding(Encoding::UTF_8)
|
|
218
|
+
end
|
|
219
|
+
result
|
|
220
|
+
end
|
|
221
|
+
private :attributes_snapshot_build
|
|
222
|
+
|
|
171
223
|
# The number of FFI accessor calls this PlanValue (and its
|
|
172
224
|
# #as_kwarg_hash descendants, via the borrowed-#at chain) have
|
|
173
225
|
# counted. Reset with #reset_crossings! before the work you want
|
|
@@ -245,9 +297,11 @@ class Leptris::XML::PlanValue
|
|
|
245
297
|
private
|
|
246
298
|
|
|
247
299
|
def kwarg_attributes
|
|
248
|
-
((@plan && @plan[:attributes]) || [])
|
|
249
|
-
|
|
250
|
-
|
|
300
|
+
rows = ((@plan && @plan[:attributes]) || [])
|
|
301
|
+
by_name = rows.each_with_object({}) { |row, h| h[row[:name]] = row }
|
|
302
|
+
attributes_snapshot.each_with_object({}) do |(k, v), result|
|
|
303
|
+
row = by_name[k]
|
|
304
|
+
result[k] = row ? cast_attribute(v, row) : v
|
|
251
305
|
end
|
|
252
306
|
end
|
|
253
307
|
|
data/vendor-src/README.md
CHANGED
|
@@ -1,5 +1,85 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.9.351] - 2026-10-13
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Block-scope externs removed engine-wide (leptris#1681,
|
|
8
|
+
PR #1684).** #1683 fixed the one symbol GCC LTO internalized
|
|
9
|
+
out from under a function-scope reference; this removes the
|
|
10
|
+
class — the count of block-scope extern declarations is now
|
|
11
|
+
zero across all 18 TUs that carried them (84 sites). Every
|
|
12
|
+
cross-TU symbol resolves through a shared internal header:
|
|
13
|
+
most declarations already existed and the TUs just didn't
|
|
14
|
+
include them; new homes were added where none existed (the
|
|
15
|
+
XSLT/Schematron bridge registrations, EXSLT pack, fn31 pack
|
|
16
|
+
and shared helpers in xpath/functions.h; per-arch simd
|
|
17
|
+
kernels in common/simd_text.h; xsd_builtin_valid in
|
|
18
|
+
xsd/xsd_internal.h; the HTML tree-builder document
|
|
19
|
+
constructor and the parse-default TLS in leptris_internal.h;
|
|
20
|
+
direct_parse_flags in flat/direct_parse.h;
|
|
21
|
+
leptris_root_doc_unregister_doc in dom/root_doc_map.h;
|
|
22
|
+
leptris_pool_drain_recycler in memory/pool.h). No ABI
|
|
23
|
+
change: symbols keep their definitions and visibility; only
|
|
24
|
+
the declaration home moved. Verified under gcc-16 -flto
|
|
25
|
+
(the configuration where the class manifests): shared +
|
|
26
|
+
CLI + tests link with zero errors; full suite 1996/1996 on
|
|
27
|
+
clang Release.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [1.9.350] - 2026-10-13
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- **GCC LTO: the XPath carrier decode survives link
|
|
35
|
+
internalization (leptris#1681, PR #1683).** The binding's
|
|
36
|
+
ppc64le (qemu, gcc-12), s390x (qemu, alpine) and truffleruby
|
|
37
|
+
source-install legs failed the engine link with `undefined
|
|
38
|
+
reference to xpath_carrier_node_of`: with Release LTO on, GCC
|
|
39
|
+
internalizes a hidden out-of-line definition when the only
|
|
40
|
+
cross-TU references are block-scope externs. The decode is now
|
|
41
|
+
`static inline` in a shared internal header
|
|
42
|
+
(xpath/xpath_carrier.h) — the definition travels with every
|
|
43
|
+
referencing TU, so internalization cannot orphan the externs.
|
|
44
|
+
The interim definition-side attributes (9985185d) stay and
|
|
45
|
+
remain no-ops for clang. Verified under gcc-16 -flto: the full
|
|
46
|
+
build (shared + CLI + tests) links clean, test_xquery 72/72.
|
|
47
|
+
|
|
48
|
+
- **Chain-compiled XSD: forward-referenced extension bases fold
|
|
49
|
+
after the schema merges, and subfiles resolve their own
|
|
50
|
+
schemaLocations (leptris-ruby#440, PR #1679).** Two defects in
|
|
51
|
+
the flat merged-import compile, both masked until the #1644
|
|
52
|
+
visited memo made each file capture exactly once. (A) The
|
|
53
|
+
content-model extension fold ran at CAPTURE time, so a base
|
|
54
|
+
defined AFTER its derived type in the same file (CT_TcPr
|
|
55
|
+
extends CT_TcPrInner, wml.xsd:2339 -> :2351) resolved to
|
|
56
|
+
nothing and its content was silently dropped - the direct
|
|
57
|
+
compile of wml.xsd had been saved only by dml's re-import
|
|
58
|
+
capturing the file twice. Extensions whose base is not yet
|
|
59
|
+
captured (or is itself still deferred) now record the base
|
|
60
|
+
name and fold in a post-capture resolver that iterates to a
|
|
61
|
+
fixpoint, splicing base content first and inherited attribute
|
|
62
|
+
rows before the derived type's own - with the same one-root-
|
|
63
|
+
particle sequence normalization capture applies. (B) The
|
|
64
|
+
subfile's OWN relative schemaLocations resolved against the
|
|
65
|
+
COMPILED file's directory: wml-2010 -> word12 -> ../iso/
|
|
66
|
+
wml.xsd worked, but wml.xsd's same-dir shared-*.xsd imports
|
|
67
|
+
then resolved against microsoft/ and silently vanished,
|
|
68
|
+
truncating every model referencing them. Each import unit now
|
|
69
|
+
threads base_dir to the subfile's directory for its own
|
|
70
|
+
capture and restores it on every exit path. (C) Attribute
|
|
71
|
+
type names resolved by bare local name, so same-name
|
|
72
|
+
simpleTypes across namespaces shadowed each other - wml's
|
|
73
|
+
ST_Jc (no centerGroup) beat shared-math's ST_Jc (centerGroup)
|
|
74
|
+
and m:defJc's val="centerGroup" failed lexical validation.
|
|
75
|
+
XsdSimple now carries the declaring unit's targetNamespace and
|
|
76
|
+
the lexical checks resolve (ns, name)-first, falling back to
|
|
77
|
+
unstamped and then cross-namespace spellings (prefix-stripped
|
|
78
|
+
names legitimately cross namespaces). Fixtures:
|
|
79
|
+
fwd_ref_ext/ (forward-ref chain through chameleon + subfile
|
|
80
|
+
dirs), ns_simple_collision/ (ST_Jc shadowing both ways).
|
|
81
|
+
|
|
82
|
+
|
|
3
83
|
## [1.9.349] - 2026-10-13
|
|
4
84
|
|
|
5
85
|
### Fixed
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
#include "../cli.h"
|
|
11
|
+
#include "../../src/leptris/xpath/xpath_carrier.h"
|
|
11
12
|
#include "../options.h"
|
|
12
13
|
#include "../error.h"
|
|
13
14
|
#include "../src/include/leptris.h"
|
|
@@ -121,7 +122,6 @@ static cli_result_t xquery_run(int argc, char** argv) {
|
|
|
121
122
|
} else if (leptris_xpath_result_type(r) == LEPTRIS_XPATH_NODESET) {
|
|
122
123
|
/* carrier-by-pointer (fold-left-009/016): synth members may
|
|
123
124
|
* carry a node pointer — render its markup. */
|
|
124
|
-
extern void* xpath_carrier_node_of(const char* s);
|
|
125
125
|
size_t n = leptris_xpath_result_count(r);
|
|
126
126
|
for (size_t k = 0; k < n; k++) {
|
|
127
127
|
if (k) putchar(' ');
|
|
@@ -97,9 +97,6 @@ static void dispatch_init(void) {
|
|
|
97
97
|
leptris_cpu_level lvl = leptris_cpu_detect();
|
|
98
98
|
#if defined(LEPTRIS_ARCH_X86) && defined(LEPTRIS_HAS_AVX2_BUILD)
|
|
99
99
|
if (lvl >= LEPTRIS_CPU_AVX2) {
|
|
100
|
-
extern int leptris_text_contains_avx2(const char*, size_t, char);
|
|
101
|
-
extern ptrdiff_t leptris_text_find3_avx2(const char*, size_t, char, char, char);
|
|
102
|
-
extern size_t leptris_text_count_char_avx2(const char*, size_t, char);
|
|
103
100
|
g_contains_fn = leptris_text_contains_avx2;
|
|
104
101
|
g_find3_fn = leptris_text_find3_avx2;
|
|
105
102
|
g_count_fn = leptris_text_count_char_avx2;
|
|
@@ -108,13 +105,6 @@ static void dispatch_init(void) {
|
|
|
108
105
|
#endif
|
|
109
106
|
#if defined(LEPTRIS_ARCH_ARM) && defined(__aarch64__)
|
|
110
107
|
if (lvl >= LEPTRIS_CPU_NEON) {
|
|
111
|
-
extern int leptris_text_contains_neon(const char*, size_t, char);
|
|
112
|
-
extern ptrdiff_t leptris_text_find3_neon(const char*, size_t, char, char, char);
|
|
113
|
-
extern size_t leptris_text_count_char_neon(const char*, size_t, char);
|
|
114
|
-
extern void leptris_text_count3_neon(const char*, size_t, char, char, char,
|
|
115
|
-
size_t*, size_t*, size_t*);
|
|
116
|
-
extern void leptris_copy_count3_neon(char*, const char*, size_t, char, char, char,
|
|
117
|
-
size_t*, size_t*, size_t*);
|
|
118
108
|
g_contains_fn = leptris_text_contains_neon;
|
|
119
109
|
g_find3_fn = leptris_text_find3_neon;
|
|
120
110
|
g_count_fn = leptris_text_count_char_neon;
|
|
@@ -227,8 +217,6 @@ size_t leptris_text_scan_events(const char* buf, size_t len,
|
|
|
227
217
|
g_scan_fn = scan_events_scalar;
|
|
228
218
|
#if defined(LEPTRIS_ARCH_ARM) && defined(__aarch64__)
|
|
229
219
|
if (leptris_cpu_detect() >= LEPTRIS_CPU_NEON) {
|
|
230
|
-
extern size_t leptris_text_scan_events_neon(const char*, size_t,
|
|
231
|
-
LeptrisScanEvent*, size_t);
|
|
232
220
|
g_scan_fn = leptris_text_scan_events_neon;
|
|
233
221
|
}
|
|
234
222
|
#endif
|
|
@@ -90,6 +90,25 @@ extern unsigned char leptris_dp_class_table[256];
|
|
|
90
90
|
* rely on leptris_text_scan_events to call it). */
|
|
91
91
|
void leptris_dp_class_table_init(void);
|
|
92
92
|
|
|
93
|
+
/* Per-arch kernels (simd_text_avx2.c / simd_text_neon.c): declared
|
|
94
|
+
* unconditionally, defined only under their platform gates. */
|
|
95
|
+
int leptris_text_contains_avx2(const char* s, size_t len, char c);
|
|
96
|
+
ptrdiff_t leptris_text_find3_avx2(const char* s, size_t len,
|
|
97
|
+
char a, char b, char c);
|
|
98
|
+
size_t leptris_text_count_char_avx2(const char* s, size_t len, char c);
|
|
99
|
+
int leptris_text_contains_neon(const char* s, size_t len, char c);
|
|
100
|
+
ptrdiff_t leptris_text_find3_neon(const char* s, size_t len,
|
|
101
|
+
char a, char b, char c);
|
|
102
|
+
size_t leptris_text_count_char_neon(const char* s, size_t len, char c);
|
|
103
|
+
void leptris_text_count3_neon(const char* s, size_t len,
|
|
104
|
+
char a, char b, char c,
|
|
105
|
+
size_t* ca, size_t* cb, size_t* cc);
|
|
106
|
+
void leptris_copy_count3_neon(char* dst, const char* src, size_t len,
|
|
107
|
+
char a, char b, char c,
|
|
108
|
+
size_t* ca, size_t* cb, size_t* cc);
|
|
109
|
+
size_t leptris_text_scan_events_neon(const char* buf, size_t len,
|
|
110
|
+
LeptrisScanEvent* events, size_t max);
|
|
111
|
+
|
|
93
112
|
/* Append events for every structural byte to out (capacity max).
|
|
94
113
|
* Returns the number of events written; returns max unchanged as
|
|
95
114
|
* an overflow signal (caller must detect return == max and treat
|
|
@@ -214,7 +214,6 @@ void leptris_copy_count3_neon(char* dst, const char* src, size_t len,
|
|
|
214
214
|
* each bit appears once (no carries). */
|
|
215
215
|
size_t leptris_text_scan_events_neon(const char* buf, size_t len,
|
|
216
216
|
LeptrisScanEvent* out, size_t max) {
|
|
217
|
-
extern void leptris_dp_class_table_init(void);
|
|
218
217
|
leptris_dp_class_table_init();
|
|
219
218
|
const uint8x16_t k_lt = vdupq_n_u8('<');
|
|
220
219
|
const uint8x16_t k_gt = vdupq_n_u8('>');
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
#include "../../include/leptris.h"
|
|
13
13
|
#include "../leptris_internal.h"
|
|
14
14
|
#include "common/port.h"
|
|
15
|
+
#include "memory/arena.h"
|
|
16
|
+
#include "dom/compact.h"
|
|
15
17
|
|
|
16
18
|
/* Library version. Single source of truth; CMakeLists.txt should
|
|
17
19
|
* keep this in sync with project(leptris VERSION ...). */
|
|
@@ -71,10 +73,6 @@ LEPTRIS_API void leptris_version_components(int* major, int* minor, int* patch)
|
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
LEPTRIS_API void leptris_thread_cleanup(void) {
|
|
74
|
-
extern void leptris_xpath_drain_thread_caches(void);
|
|
75
|
-
extern void leptris_root_doc_drain_thread_caches(void);
|
|
76
|
-
extern void leptris_pool_drain_recycler(void);
|
|
77
|
-
extern void leptris_arena_retain_drain(void);
|
|
78
76
|
leptris_xpath_drain_thread_caches();
|
|
79
77
|
leptris_root_doc_drain_thread_caches();
|
|
80
78
|
leptris_pool_drain_recycler();
|
|
@@ -155,7 +153,6 @@ LEPTRIS_API int leptris_document_get_strict(LeptrisDocument doc) {
|
|
|
155
153
|
}
|
|
156
154
|
|
|
157
155
|
LEPTRIS_API void leptris_explicit_cleanup(void) {
|
|
158
|
-
extern void leptris_compact_cleanup(void);
|
|
159
156
|
leptris_compact_cleanup();
|
|
160
157
|
}
|
|
161
158
|
|
|
@@ -15,6 +15,9 @@ extern "C" {
|
|
|
15
15
|
|
|
16
16
|
void leptris_root_doc_register(LeptrisElement root, struct leptris_document* doc);
|
|
17
17
|
void leptris_root_doc_unregister(LeptrisElement root);
|
|
18
|
+
/* #1038: unregister every element registered for this document
|
|
19
|
+
* (fallback-path registrations). Returns the number removed. */
|
|
20
|
+
size_t leptris_root_doc_unregister_doc(struct leptris_document* doc);
|
|
18
21
|
struct leptris_document* leptris_root_doc_lookup(LeptrisElement root);
|
|
19
22
|
void leptris_root_doc_memo_invalidate(const struct leptris_document* doc);
|
|
20
23
|
/* Test hook (#1242): the memo's current root, or NULL. */
|
|
@@ -37,11 +37,18 @@
|
|
|
37
37
|
#include "../common/port.h"
|
|
38
38
|
#include "../common/simd_text.h"
|
|
39
39
|
#include "../dtd/model.h"
|
|
40
|
-
|
|
40
|
+
#include "../include/leptris/dtd.h" /* leptris_dtd_free is LEPTRIS_API */
|
|
41
|
+
#include "../dom/diag.h"
|
|
42
|
+
#include "../memory/pool.h"
|
|
41
43
|
#include <string.h>
|
|
42
44
|
#include <stdlib.h>
|
|
43
45
|
#include <stdio.h>
|
|
44
46
|
|
|
47
|
+
/* File-scope externs: engine config TLS defined in core.c (declared
|
|
48
|
+
* in leptris_internal.h; this TU reads it without the umbrella) and
|
|
49
|
+
* a compact-mode hook. File scope, not block scope — block-scope
|
|
50
|
+
* externs break GCC LTO (leptris#1681). */
|
|
51
|
+
extern LEPTRIS_THREAD_LOCAL int g_leptris_max_depth;
|
|
45
52
|
extern LEPTRIS_THREAD_LOCAL int g_leptris_strict_mode;
|
|
46
53
|
extern void leptris_compact_set_current_document(struct leptris_document* doc);
|
|
47
54
|
int leptris_element_add_namespace(struct leptris_element* elem,
|
|
@@ -636,10 +643,6 @@ static inline int dp_add_attr_inline(DParser* p, LeptrisElement elem,
|
|
|
636
643
|
}
|
|
637
644
|
if (dup) {
|
|
638
645
|
if (p->doc) {
|
|
639
|
-
extern struct LeptrisDiag* leptris_diag_emit(
|
|
640
|
-
struct LeptrisDiag**, int*, int*,
|
|
641
|
-
LeptrisDiagKind, LeptrisNodeRef,
|
|
642
|
-
const char*, ...);
|
|
643
646
|
char qname[130];
|
|
644
647
|
size_t ql = attr->name_view.length < 129
|
|
645
648
|
? attr->name_view.length : 129;
|
|
@@ -889,7 +892,6 @@ static LEPTRIS_NOINLINE int dp_parse_doctype(char** pos_io, char* end,
|
|
|
889
892
|
subset_start, (size_t)(subset_end - subset_start),
|
|
890
893
|
pool);
|
|
891
894
|
if (parsed) {
|
|
892
|
-
extern void leptris_dtd_free(struct LeptrisDTD*);
|
|
893
895
|
if (dtd) {
|
|
894
896
|
/* a second <!DOCTYPE: the first model wins (the
|
|
895
897
|
* duplicate-attribute keep-first rule); the
|
|
@@ -1597,7 +1599,6 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
|
|
|
1597
1599
|
p.pool = pool;
|
|
1598
1600
|
p.doc = doc;
|
|
1599
1601
|
{
|
|
1600
|
-
extern LEPTRIS_THREAD_LOCAL int g_leptris_max_depth;
|
|
1601
1602
|
size_t dcap = g_leptris_max_depth > 0
|
|
1602
1603
|
? (size_t)g_leptris_max_depth : (size_t)DP_MAX_DEPTH;
|
|
1603
1604
|
if (!dp_stacks_init(&p, dcap)) goto fail;
|
|
@@ -1979,7 +1980,6 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
|
|
|
1979
1980
|
/* Respect custom depth limit (g_leptris_max_depth)
|
|
1980
1981
|
* when set by the caller; fall back to the
|
|
1981
1982
|
* compile-time default otherwise. */
|
|
1982
|
-
extern LEPTRIS_THREAD_LOCAL int g_leptris_max_depth;
|
|
1983
1983
|
int max_depth = g_leptris_max_depth > 0
|
|
1984
1984
|
? g_leptris_max_depth : DP_MAX_DEPTH;
|
|
1985
1985
|
if (p.depth >= max_depth) goto fail;
|
|
@@ -2097,11 +2097,6 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
|
|
|
2097
2097
|
while ((int)p.depth - 1 > anc) {
|
|
2098
2098
|
LeptrisElement ce =
|
|
2099
2099
|
p.open_stack[p.depth - 1];
|
|
2100
|
-
extern struct LeptrisDiag*
|
|
2101
|
-
leptris_diag_emit(
|
|
2102
|
-
struct LeptrisDiag**, int*, int*,
|
|
2103
|
-
LeptrisDiagKind, LeptrisNodeRef,
|
|
2104
|
-
const char*, ...);
|
|
2105
2100
|
leptris_diag_emit(
|
|
2106
2101
|
&p.doc->parse_diags,
|
|
2107
2102
|
&p.doc->parse_diag_count,
|
|
@@ -2121,10 +2116,6 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
|
|
|
2121
2116
|
}
|
|
2122
2117
|
goto close_matched;
|
|
2123
2118
|
}
|
|
2124
|
-
extern struct LeptrisDiag* leptris_diag_emit(
|
|
2125
|
-
struct LeptrisDiag**, int*, int*,
|
|
2126
|
-
LeptrisDiagKind, LeptrisNodeRef,
|
|
2127
|
-
const char*, ...);
|
|
2128
2119
|
leptris_diag_emit(
|
|
2129
2120
|
&p.doc->parse_diags,
|
|
2130
2121
|
&p.doc->parse_diag_count,
|
|
@@ -2347,10 +2338,6 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
|
|
|
2347
2338
|
* implicitly; the tree commits. */
|
|
2348
2339
|
while (p.depth > 0) {
|
|
2349
2340
|
LeptrisElement ce = p.open_stack[p.depth - 1];
|
|
2350
|
-
extern struct LeptrisDiag* leptris_diag_emit(
|
|
2351
|
-
struct LeptrisDiag**, int*, int*,
|
|
2352
|
-
LeptrisDiagKind, LeptrisNodeRef,
|
|
2353
|
-
const char*, ...);
|
|
2354
2341
|
leptris_diag_emit(
|
|
2355
2342
|
&p.doc->parse_diags, &p.doc->parse_diag_count,
|
|
2356
2343
|
&p.doc->parse_diag_cap,
|
|
@@ -2493,7 +2480,6 @@ fail:
|
|
|
2493
2480
|
* RECOVER diag (e.g. duplicate attribute) can precede the
|
|
2494
2481
|
* failure — nightly-fuzz leak-75e0ee81, 2304 bytes. */
|
|
2495
2482
|
{
|
|
2496
|
-
extern void leptris_diag_free(struct LeptrisDiag**, int*, int*);
|
|
2497
2483
|
leptris_diag_free(&doc->parse_diags, &doc->parse_diag_count,
|
|
2498
2484
|
&doc->parse_diag_cap);
|
|
2499
2485
|
}
|
|
@@ -2503,7 +2489,6 @@ fail:
|
|
|
2503
2489
|
* assigns doc->dtd; without this free the model leaks
|
|
2504
2490
|
* (nightly-fuzz leak-e3246602, 8 bytes). */
|
|
2505
2491
|
{
|
|
2506
|
-
extern void leptris_dtd_free(struct LeptrisDTD*);
|
|
2507
2492
|
if (p.dtd) leptris_dtd_free(p.dtd);
|
|
2508
2493
|
}
|
|
2509
2494
|
free(doc->line_breaks);
|
|
@@ -2746,7 +2731,6 @@ static int il_scan_body(char* s, size_t len, int drop_ws, IlCtx* c,
|
|
|
2746
2731
|
c->last_child[c->depth - 1] = ri;
|
|
2747
2732
|
|
|
2748
2733
|
if (!r.self_closing) {
|
|
2749
|
-
extern LEPTRIS_THREAD_LOCAL int g_leptris_max_depth;
|
|
2750
2734
|
int max_depth = g_leptris_max_depth > 0
|
|
2751
2735
|
? g_leptris_max_depth : DP_MAX_DEPTH;
|
|
2752
2736
|
if (c->depth >= max_depth) return 0;
|
|
@@ -2856,7 +2840,6 @@ static int il_scan_body(char* s, size_t len, int drop_ws, IlCtx* c,
|
|
|
2856
2840
|
int leptris_il_scan(char* s, size_t len, int drop_ws, IlCtx* c,
|
|
2857
2841
|
uint32_t* root_out, size_t* trail_off,
|
|
2858
2842
|
size_t* trail_len) {
|
|
2859
|
-
extern LEPTRIS_THREAD_LOCAL int g_leptris_max_depth;
|
|
2860
2843
|
size_t dcap = g_leptris_max_depth > 0
|
|
2861
2844
|
? (size_t)g_leptris_max_depth : (size_t)LEPTRIS_IL_MAX_DEPTH;
|
|
2862
2845
|
if (!il_stacks_init(c, dcap)) return 0;
|
|
@@ -2872,10 +2855,6 @@ int leptris_il_scan(char* s, size_t len, int drop_ws, IlCtx* c,
|
|
|
2872
2855
|
static struct leptris_document* dp_il_build(
|
|
2873
2856
|
char* scratch, size_t len, IlCtx* c, uint32_t root_rec,
|
|
2874
2857
|
size_t trail_off, size_t trail_len, int drop_ws) {
|
|
2875
|
-
extern LeptrisArena* leptris_arena_create(size_t);
|
|
2876
|
-
extern LeptrisMemoryPool* leptris_pool_create_arena_backed(
|
|
2877
|
-
LeptrisArena*, int);
|
|
2878
|
-
extern void leptris_arena_destroy(LeptrisArena*);
|
|
2879
2858
|
|
|
2880
2859
|
/* scratch (with its NUL runway) is caller-built and becomes the
|
|
2881
2860
|
* document's parse_scratch; pristine is the immutable copy. */
|
|
@@ -3113,10 +3092,6 @@ static struct leptris_document* dp_il_build(
|
|
|
3113
3092
|
}
|
|
3114
3093
|
if (dup) {
|
|
3115
3094
|
if (doc) {
|
|
3116
|
-
extern struct LeptrisDiag* leptris_diag_emit(
|
|
3117
|
-
struct LeptrisDiag**, int*, int*,
|
|
3118
|
-
LeptrisDiagKind, LeptrisNodeRef,
|
|
3119
|
-
const char*, ...);
|
|
3120
3095
|
char qn[130];
|
|
3121
3096
|
size_t ql = a->name_len < 129
|
|
3122
3097
|
? a->name_len : 129;
|
|
@@ -38,4 +38,8 @@ struct leptris_document* direct_parse(const char* xml, size_t len);
|
|
|
38
38
|
*/
|
|
39
39
|
struct leptris_document* direct_parse_inplace(char* buf, size_t len);
|
|
40
40
|
|
|
41
|
+
/* Flags variant — carries LEPTRIS_PARSE_* flags (recover mode #1660). */
|
|
42
|
+
struct leptris_document* direct_parse_flags(const char* xml, size_t len,
|
|
43
|
+
unsigned parse_flags);
|
|
44
|
+
|
|
41
45
|
#endif /* LEPTRIS_FLAT_DIRECT_PARSE_H */
|
|
@@ -5526,8 +5526,6 @@ static LeptrisDocument html_parse_shared(
|
|
|
5526
5526
|
* extension blocks in a different malloc region, pushing every
|
|
5527
5527
|
* borrowed pointer out of the int32 compact range (measured
|
|
5528
5528
|
* 776k overflow-table inserts on the 2.6 MB table shape). */
|
|
5529
|
-
extern struct leptris_document* leptris_document_create_with_arena_size(
|
|
5530
|
-
size_t arena_size);
|
|
5531
5529
|
struct leptris_document* doc =
|
|
5532
5530
|
(struct leptris_document*)leptris_document_create_with_arena_size(
|
|
5533
5531
|
len * 10 + (1u << 18));
|