From 14adcb9db89f4a668210a56d909cdca96088aae2 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 30 Sep 2023 15:34:39 +0100 Subject: Use `or_break` and `or_continue` where appropriate in the core library --- core/encoding/json/marshal.odin | 9 ++++----- core/encoding/xml/helpers.odin | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'core/encoding') diff --git a/core/encoding/json/marshal.odin b/core/encoding/json/marshal.odin index 43f464bdb..85eca50b6 100644 --- a/core/encoding/json/marshal.odin +++ b/core/encoding/json/marshal.odin @@ -265,9 +265,8 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err: i := 0 for bucket_index in 0.. (err: #partial switch info in ti.variant { case runtime.Type_Info_String: switch s in a { - case string: name = s - case cstring: name = string(s) + case string: name = s + case cstring: name = string(s) } opt_write_key(w, opt, name) or_return diff --git a/core/encoding/xml/helpers.odin b/core/encoding/xml/helpers.odin index 200c5c1de..e0b5ecc32 100644 --- a/core/encoding/xml/helpers.odin +++ b/core/encoding/xml/helpers.odin @@ -21,13 +21,13 @@ find_child_by_ident :: proc(doc: ^Document, parent_id: Element_ID, ident: string /* Skip commments. They have no name. */ - if child.kind != .Element { continue } + if child.kind != .Element { continue } /* If the ident matches and it's the nth such child, return it. */ if child.ident == ident { - if count == nth { return child_id, true } + if count == nth { return child_id, true } count += 1 } } -- cgit v1.2.3