aboutsummaryrefslogtreecommitdiff
path: root/core/encoding/xml/xml_reader.odin
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2026-01-30 10:49:55 +0000
committerGitHub <noreply@github.com>2026-01-30 10:49:55 +0000
commit19b545e7cb0b09a7c8b3424ca8276b9e37f8de80 (patch)
tree974b844bf082c526f6a12396c4a80adfc73b9a60 /core/encoding/xml/xml_reader.odin
parent8b745c3909a3482aebe27998d8b870286e448e35 (diff)
parent5a21213fa5e2c74d5021adb2a87f0cc441a38eab (diff)
Merge branch 'master' into bill/feature-using-stmt
Diffstat (limited to 'core/encoding/xml/xml_reader.odin')
-rw-r--r--core/encoding/xml/xml_reader.odin8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/encoding/xml/xml_reader.odin b/core/encoding/xml/xml_reader.odin
index 0e773fd8a..8f8fffe14 100644
--- a/core/encoding/xml/xml_reader.odin
+++ b/core/encoding/xml/xml_reader.odin
@@ -294,7 +294,7 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
comment := scan_comment(t) or_return
if .Intern_Comments in opts.flags {
- if len(doc.elements) == 0 {
+ if doc.element_count == 0 {
append(&doc.comments, comment)
} else {
el := new_element(doc)
@@ -308,6 +308,7 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
case .Open_Bracket:
// This could be a CDATA tag part of a tag's body. Unread the `<![`
t.offset -= 3
+ t.read_offset = t.offset
// Instead of calling `parse_body` here, we could also `continue loop`
// and fall through to the `case:` at the bottom of the outer loop.
@@ -385,7 +386,8 @@ load_from_file :: proc(filename: string, options := DEFAULT_OPTIONS, error_handl
return parse_bytes(data, options, filename, error_handler, allocator)
}
-destroy :: proc(doc: ^Document) {
+destroy :: proc(doc: ^Document, allocator := context.allocator) {
+ context.allocator = allocator
if doc == nil { return }
for el in doc.elements {
@@ -625,4 +627,4 @@ new_element :: proc(doc: ^Document) -> (id: Element_ID) {
cur := doc.element_count
doc.element_count += 1
return cur
-} \ No newline at end of file
+}