diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2023-12-23 18:11:52 +0100 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2024-03-04 17:26:19 +0100 |
| commit | 154e0d41c6f77feb8a11ff8a6cb4449c11dd767e (patch) | |
| tree | 69805341b820f91872f2ed56b5db497f36202233 /core | |
| parent | 3fccc77829d6479b972026c5fee7ef0f34ac589e (diff) | |
encoding/cbor: fix wrong allocator bug
Diffstat (limited to 'core')
| -rw-r--r-- | core/encoding/cbor/coding.odin | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/encoding/cbor/coding.odin b/core/encoding/cbor/coding.odin index 32ecf52bc..ee928f68e 100644 --- a/core/encoding/cbor/coding.odin +++ b/core/encoding/cbor/coding.odin @@ -100,10 +100,9 @@ decode :: decode_from // Decodes the given string as CBOR. // See docs on the proc group `decode` for more information. decode_from_string :: proc(s: string, flags: Decoder_Flags = {}, allocator := context.allocator) -> (v: Value, err: Decode_Error) { - context.allocator = allocator r: strings.Reader strings.reader_init(&r, s) - return decode_from_reader(strings.reader_to_stream(&r), flags) + return decode_from_reader(strings.reader_to_stream(&r), flags, allocator) } // Reads a CBOR value from the given reader. @@ -489,7 +488,7 @@ _decode_text_ptr :: proc(d: Decoder, add: Add) -> (v: ^Text, err: Decode_Error) return } -_decode_text :: proc(d: Decoder, add: Add, allocator := context.temp_allocator) -> (v: Text, err: Decode_Error) { +_decode_text :: proc(d: Decoder, add: Add, allocator := context.allocator) -> (v: Text, err: Decode_Error) { return (Text)(_decode_bytes(d, add, .Text, allocator) or_return), nil } |