aboutsummaryrefslogtreecommitdiff
path: root/core/encoding/xml/example/xml_example.odin
diff options
context:
space:
mode:
authorKrzesimir Nowak <qdlacz@gmail.com>2026-02-17 21:51:01 +0100
committerKrzesimir Nowak <qdlacz@gmail.com>2026-02-17 21:58:08 +0100
commit47775214d6287537d6e148c37e0c49aa8228b81b (patch)
tree938e3958bcf021c4102ddd7187a85d73c2d6d04c /core/encoding/xml/example/xml_example.odin
parentc666dbf7c2d77d1f765eb6ddbde50540b46c3574 (diff)
Fix some tools and examples after core:os update and using-stmt feature
Diffstat (limited to 'core/encoding/xml/example/xml_example.odin')
-rw-r--r--core/encoding/xml/example/xml_example.odin22
1 files changed, 9 insertions, 13 deletions
diff --git a/core/encoding/xml/example/xml_example.odin b/core/encoding/xml/example/xml_example.odin
index 9648143db..267ae2ca9 100644
--- a/core/encoding/xml/example/xml_example.odin
+++ b/core/encoding/xml/example/xml_example.odin
@@ -10,8 +10,6 @@ import "core:hash"
N :: 1
example :: proc() {
- using fmt
-
docs: [N]^xml.Document
errs: [N]xml.Error
times: [N]time.Duration
@@ -59,23 +57,23 @@ example :: proc() {
fmt.printf("[Average]: %v bytes in %.2f ms (%.2f MiB/s).\n", len(input), average_ms, average_speed)
if errs[0] != .None {
- printf("Load/Parse error: %v\n", errs[0])
+ fmt.printf("Load/Parse error: %v\n", errs[0])
if errs[0] == .File_Error {
- println("\"unicode.xml\" not found. Did you run \"tests\\download_assets.py\"?")
+ fmt.println("\"unicode.xml\" not found. Did you run \"tests\\download_assets.py\"?")
}
return
}
charlist, charlist_ok := xml.find_child_by_ident(docs[0], 0, "charlist")
if !charlist_ok {
- eprintln("Could not locate top-level `<charlist>` tag.")
- return
+ fmt.eprintln("Could not locate top-level `<charlist>` tag.")
+ return
}
- printf("Found `<charlist>` with %v children, %v elements total\n", len(docs[0].elements[charlist].value), docs[0].element_count)
+ fmt.printf("Found `<charlist>` with %v children, %v elements total\n", len(docs[0].elements[charlist].value), docs[0].element_count)
crc32 := doc_hash(docs[0], false)
- printf("[%v] CRC32: 0x%08x\n", "🎉" if crc32 == 0x420dbac5 else "🤬", crc32)
+ fmt.printf("[%v] CRC32: 0x%08x\n", "🎉" if crc32 == 0x420dbac5 else "🤬", crc32)
for round in 0..<N {
defer xml.destroy(docs[round])
@@ -94,8 +92,6 @@ doc_hash :: proc(doc: ^xml.Document, print := false) -> (crc32: u32) {
}
main :: proc() {
- using fmt
-
track: mem.Tracking_Allocator
mem.tracking_allocator_init(&track, context.allocator)
context.allocator = mem.tracking_allocator(&track)
@@ -103,10 +99,10 @@ main :: proc() {
example()
if len(track.allocation_map) > 0 {
- println()
+ fmt.println()
for _, v in track.allocation_map {
- printf("%v Leaked %v bytes.\n", v.location, v.size)
+ fmt.printf("%v Leaked %v bytes.\n", v.location, v.size)
}
}
- println("Done and cleaned up!")
+ fmt.println("Done and cleaned up!")
}