mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-23 23:05:18 +00:00
Add json.is_valid
This commit is contained in:
@@ -3,7 +3,6 @@ package json
|
||||
import "core:mem"
|
||||
import "core:unicode/utf8"
|
||||
import "core:strconv"
|
||||
import "core:strings"
|
||||
|
||||
Parser :: struct {
|
||||
tok: Tokenizer,
|
||||
@@ -247,7 +246,9 @@ unquote_string :: proc(token: Token, allocator := context.allocator) -> string {
|
||||
i += w;
|
||||
}
|
||||
if i == len(s) {
|
||||
return strings.new_string(s, allocator);
|
||||
b := make([]byte, len(s), allocator);
|
||||
copy(b, cast([]byte)s);
|
||||
return string(b);
|
||||
}
|
||||
|
||||
b := make([]byte, len(s) + 2*utf8.UTF_MAX, allocator);
|
||||
|
||||
Reference in New Issue
Block a user