encoding/cbor: cleanup default temp allocator

This commit is contained in:
Laytan Laats
2024-03-04 17:26:19 +01:00
parent 46b58ad48d
commit cb8bb8bfd8
4 changed files with 77 additions and 35 deletions
+1 -14
View File
@@ -77,21 +77,8 @@ marshal_into_writer :: proc(w: io.Writer, v: any, flags := ENCODE_SMALL) -> Mars
// See docs on the `marshal_into` proc group for more info.
marshal_into_encoder :: proc(e: Encoder, v: any) -> (err: Marshal_Error) {
e := e
init: bool
defer if init {
e.flags &~= {._In_Progress}
}
// If not in progress we do initialization and set in progress.
if ._In_Progress not_in e.flags {
init = true
e.flags |= {._In_Progress}
if .Self_Described_CBOR in e.flags {
err_conv(_encode_u64(e, TAG_SELF_DESCRIBED_CBOR, .Tag)) or_return
}
}
err_conv(ENCODE_PROGRESS_GUARD(&e)) or_return
if v == nil {
return _encode_nil(e.writer)