Add #optional_allocator_error

This commit is contained in:
Wrath
2026-02-16 14:40:37 -05:00
parent f0912ce4c2
commit 06b10f9ae8
2 changed files with 3 additions and 3 deletions

View File

@@ -128,7 +128,7 @@ decode_rune_in_string :: proc "contextless" (s: string16) -> (r: rune, width: in
return
}
string_to_runes :: proc "odin" (s: string16, allocator := context.allocator) -> (runes: []rune, err: runtime.Allocator_Error) {
string_to_runes :: proc "odin" (s: string16, allocator := context.allocator) -> (runes: []rune, err: runtime.Allocator_Error) #optional_allocator_error {
n := rune_count(s)
runes = make([]rune, n, allocator) or_return

View File

@@ -147,7 +147,7 @@ decode_rune_in_bytes :: proc "contextless" (s: []u8) -> (rune, int) {
}
@(require_results)
string_to_runes :: proc "odin" (s: string, allocator := context.allocator) -> (runes: []rune, err: runtime.Allocator_Error) {
string_to_runes :: proc "odin" (s: string, allocator := context.allocator) -> (runes: []rune, err: runtime.Allocator_Error) #optional_allocator_error {
n := rune_count_in_string(s)
runes = make([]rune, n, allocator) or_return
@@ -160,7 +160,7 @@ string_to_runes :: proc "odin" (s: string, allocator := context.allocator) -> (r
}
@(require_results)
runes_to_string :: proc "odin" (runes: []rune, allocator := context.allocator) -> (s: string, err: runtime.Allocator_Error) {
runes_to_string :: proc "odin" (runes: []rune, allocator := context.allocator) -> (s: string, err: runtime.Allocator_Error) #optional_allocator_error {
byte_count := 0
for r in runes {
_, w := encode_rune(r)