diff options
| author | gingerBill <bill@gingerbill.org> | 2024-03-06 11:49:17 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-03-06 11:49:17 +0000 |
| commit | 5eef29290c72e02620d2059ba65b52a3acf2784d (patch) | |
| tree | c1e1d35a1912fe6d9caf7641314e9b99178c69ee /core/encoding/json/parser.odin | |
| parent | 7ae22b7ce507dca47c3da7aa6d750a8fb557e1ad (diff) | |
Fix #3250
Diffstat (limited to 'core/encoding/json/parser.odin')
| -rw-r--r-- | core/encoding/json/parser.odin | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/encoding/json/parser.odin b/core/encoding/json/parser.odin index 6faaf3f32..8bcef1339 100644 --- a/core/encoding/json/parser.odin +++ b/core/encoding/json/parser.odin @@ -204,8 +204,8 @@ parse_array :: proc(p: ^Parser) -> (value: Value, err: Error) { } @(private) -bytes_make :: proc(size, alignment: int, allocator: mem.Allocator) -> (bytes: []byte, err: Error) { - b, berr := mem.alloc_bytes(size, alignment, allocator) +bytes_make :: proc(size, alignment: int, allocator: mem.Allocator, loc := #caller_location) -> (bytes: []byte, err: Error) { + b, berr := mem.alloc_bytes(size, alignment, allocator, loc) if berr != nil { if berr == .Out_Of_Memory { err = .Out_Of_Memory @@ -217,9 +217,9 @@ bytes_make :: proc(size, alignment: int, allocator: mem.Allocator) -> (bytes: [] return } -clone_string :: proc(s: string, allocator: mem.Allocator) -> (str: string, err: Error) { +clone_string :: proc(s: string, allocator: mem.Allocator, loc := #caller_location) -> (str: string, err: Error) { n := len(s) - b := bytes_make(n+1, 1, allocator) or_return + b := bytes_make(n+1, 1, allocator, loc) or_return copy(b, s) if len(b) > n { b[n] = 0 @@ -290,7 +290,7 @@ parse_object :: proc(p: ^Parser) -> (value: Value, err: Error) { // IMPORTANT NOTE(bill): unquote_string assumes a mostly valid string -unquote_string :: proc(token: Token, spec: Specification, allocator := context.allocator) -> (value: string, err: Error) { +unquote_string :: proc(token: Token, spec: Specification, allocator := context.allocator, loc := #caller_location) -> (value: string, err: Error) { get_u2_rune :: proc(s: string) -> rune { if len(s) < 4 || s[0] != '\\' || s[1] != 'x' { return -1 @@ -359,7 +359,7 @@ unquote_string :: proc(token: Token, spec: Specification, allocator := context.a i += w } if i == len(s) { - return clone_string(s, allocator) + return clone_string(s, allocator, loc) } b := bytes_make(len(s) + 2*utf8.UTF_MAX, 1, allocator) or_return |