leptris 1.9.342.0-aarch64-linux → 1.9.343.0-aarch64-linux
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/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/xsd.rb +33 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 14ee27545e9ec2c3103e471404628d3fe27912084429ff355541e39aebc945f1
|
|
4
|
+
data.tar.gz: 1e9ed83a1899d6d6680450db23366ddb511bf6bbd93aa28e15375f253481f4fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8019b4b6aeeb9df471a09a7823693ed11e7387f42348f546acaa897317b0970706e58a1af68f861953a603911d95a4ab5904b39d430e52bfc7a86687ee2ff1f0
|
|
7
|
+
data.tar.gz: ee7d953a0da8ae106f6c9e45fb13e84b6ff6d1d8c46c5c70e28a403279e0d8b83be3daf8d76b3a2dc8d6682c271ab4351aa9a05e41640988c81e33825ac874b4
|
data/lib/leptris/version.rb
CHANGED
data/lib/leptris/xml/xsd.rb
CHANGED
|
@@ -48,6 +48,28 @@ module Leptris::XML::XSD
|
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
+
# Deterministic drop (#362.3 / moxml): frees the compiled
|
|
52
|
+
# schema NOW instead of waiting for GC — long-lived validation
|
|
53
|
+
# services holding dozens of schemas stop parking engine-side
|
|
54
|
+
# trees for the process lifetime. The AutoPointer's GC
|
|
55
|
+
# finalizer is disarmed first (autorelease=false), so the free
|
|
56
|
+
# happens exactly once. Faces on a released schema raise.
|
|
57
|
+
#
|
|
58
|
+
# schema = Leptris::XML::XSD.compile_file(path)
|
|
59
|
+
# schema.release # => true
|
|
60
|
+
# schema.released? # => true
|
|
61
|
+
def release
|
|
62
|
+
return true if released?
|
|
63
|
+
@handle.autorelease = false
|
|
64
|
+
Leptris::XML::FFI.leptris_xsd_free(@handle)
|
|
65
|
+
@released = true
|
|
66
|
+
true
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def released?
|
|
70
|
+
instance_variable_defined?(:@released) ? @released : false
|
|
71
|
+
end
|
|
72
|
+
|
|
51
73
|
# Compile a schema from XML text. Raises Error when the text is
|
|
52
74
|
# not usable at all (not well-formed, no root); schema-level
|
|
53
75
|
# problems compile to a handle whose #error carries the detail
|
|
@@ -82,12 +104,14 @@ module Leptris::XML::XSD
|
|
|
82
104
|
# Number of top-level schema declarations the compiler
|
|
83
105
|
# recognized (elements, types, groups, ...).
|
|
84
106
|
def declaration_count
|
|
107
|
+
check_released!
|
|
85
108
|
Leptris::XML::FFI.leptris_xsd_declaration_count(@handle)
|
|
86
109
|
end
|
|
87
110
|
|
|
88
111
|
# The engine's schema-level error message, or nil when the
|
|
89
112
|
# schema compiled cleanly.
|
|
90
113
|
def error
|
|
114
|
+
check_released!
|
|
91
115
|
msg = Leptris::XML::FFI.leptris_xsd_error(@handle)
|
|
92
116
|
msg.nil? || msg.empty? ? nil : msg
|
|
93
117
|
end
|
|
@@ -97,6 +121,7 @@ module Leptris::XML::XSD
|
|
|
97
121
|
# name) — restriction chains validate every hop's facets,
|
|
98
122
|
# cycle-guarded. Unknown type names raise (the -1 contract).
|
|
99
123
|
def simple_valid?(type_name, lexical)
|
|
124
|
+
check_released!
|
|
100
125
|
tri_state(
|
|
101
126
|
Leptris::XML::FFI.leptris_xsd_simple_valid(
|
|
102
127
|
@handle, type_name.to_s, lexical.to_s),
|
|
@@ -109,6 +134,7 @@ module Leptris::XML::XSD
|
|
|
109
134
|
# and child content models through the Thompson NFA. Returns
|
|
110
135
|
# true/false.
|
|
111
136
|
def valid?(document)
|
|
137
|
+
check_released!
|
|
112
138
|
tri_state(
|
|
113
139
|
Leptris::XML::FFI.leptris_xsd_validate(
|
|
114
140
|
@handle, document.c_ptr), "invalid document handle")
|
|
@@ -117,6 +143,7 @@ module Leptris::XML::XSD
|
|
|
117
143
|
# The enumerated failure list of the last #validate run
|
|
118
144
|
# (empty when valid; the NEXT validate replaces the list).
|
|
119
145
|
def validate_errors(document)
|
|
146
|
+
check_released!
|
|
120
147
|
valid?(document)
|
|
121
148
|
Leptris::XML::FFI.leptris_xsd_error_count(@handle).times.map do |i|
|
|
122
149
|
Leptris::XML::FFI.leptris_xsd_error_at(@handle, i)
|
|
@@ -129,6 +156,7 @@ module Leptris::XML::XSD
|
|
|
129
156
|
# + effective namespace extracted per child). Unknown element
|
|
130
157
|
# declarations raise (the -1 contract).
|
|
131
158
|
def content_valid?(element_name, children)
|
|
159
|
+
check_released!
|
|
132
160
|
kids = children.to_a
|
|
133
161
|
nb, na = Leptris::XML::CStringArray.to_c(
|
|
134
162
|
kids.map { |c| c.name.to_s })
|
|
@@ -142,6 +170,11 @@ module Leptris::XML::XSD
|
|
|
142
170
|
|
|
143
171
|
private
|
|
144
172
|
|
|
173
|
+
def check_released!
|
|
174
|
+
raise Leptris::XML::UseAfterFreeError,
|
|
175
|
+
"schema released (moxml #362.3)" if released?
|
|
176
|
+
end
|
|
177
|
+
|
|
145
178
|
# A child's effective namespace URI (nil = none) — read
|
|
146
179
|
# through its own c_ptr, so docless wrappers work.
|
|
147
180
|
def child_ns_uri(node)
|