diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2026-02-11 16:34:50 +0100 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2026-02-11 16:34:50 +0100 |
| commit | b5bf28dc47dd1c32a45ba0bbedcbcef80409b798 (patch) | |
| tree | c31f65870544ff80fc0910bc46458280ffe902fe /core | |
| parent | bd3cf2a1e6430e916bc9721296a2b18675e89dab (diff) | |
| parent | 2618a03514c0d574929332061b223c106e1399f9 (diff) | |
Merge branch 'master' of github.com:odin-lang/Odin
Diffstat (limited to 'core')
| -rw-r--r-- | core/container/xar/xar.odin | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/container/xar/xar.odin b/core/container/xar/xar.odin index 556f93ee5..b2f1a5499 100644 --- a/core/container/xar/xar.odin +++ b/core/container/xar/xar.odin @@ -26,7 +26,6 @@ */ package container_xar -@(require) import "core:mem" @(require) import "base:intrinsics" @(require) import "base:runtime" @@ -73,7 +72,7 @@ MAX_SHIFT :: PLATFORM_BITS>>1 Array :: struct($T: typeid, $SHIFT: uint) where 0 < SHIFT, SHIFT <= MAX_SHIFT { chunks: [(1 << (_LOG2_PLATFORM_BITS - intrinsics.constant_log2(SHIFT))) + 1][^]T, len: int, - allocator: mem.Allocator, + allocator: runtime.Allocator, } @@ -99,7 +98,7 @@ destroy :: proc(x: ^$X/Array($T, $SHIFT)) { if c != nil { n := 1 << (SHIFT + uint(i if i > 0 else 1) - 1) size_in_bytes := n * size_of(T) - mem.free_with_size(c, size_in_bytes, x.allocator) + runtime.mem_free_with_size(c, size_in_bytes, x.allocator) } } x^ = {} @@ -257,7 +256,7 @@ Example: fmt.println(xar.get(&x, 1)) // world } */ -push_back_elem :: proc(x: ^$X/Array($T, $SHIFT), value: T, loc := #caller_location) -> (n: int, err: mem.Allocator_Error) { +push_back_elem :: proc(x: ^$X/Array($T, $SHIFT), value: T, loc := #caller_location) -> (n: int, err: runtime.Allocator_Error) { if x.allocator.procedure == nil { // to minic `[dynamic]T` behaviour x.allocator = context.allocator @@ -284,7 +283,7 @@ Append multiple elements to the end of the exponential array. - number of elements successfully added - allocation error if chunk allocation failed (partial append possible) */ -push_back_elems :: proc(x: ^$X/Array($T, $SHIFT), values: ..T, loc := #caller_location) -> (n: int, err: mem.Allocator_Error) { +push_back_elems :: proc(x: ^$X/Array($T, $SHIFT), values: ..T, loc := #caller_location) -> (n: int, err: runtime.Allocator_Error) { for value in values { n += push_back_elem(x, value, loc) or_return } @@ -318,7 +317,7 @@ Example: } */ @(require_results) -push_back_elem_and_get_ptr :: proc(x: ^$X/Array($T, $SHIFT), value: T, loc := #caller_location) -> (ptr: ^T, err: mem.Allocator_Error) { +push_back_elem_and_get_ptr :: proc(x: ^$X/Array($T, $SHIFT), value: T, loc := #caller_location) -> (ptr: ^T, err: runtime.Allocator_Error) { if x.allocator.procedure == nil { // to minic `[dynamic]T` behaviour x.allocator = context.allocator |