aboutsummaryrefslogtreecommitdiff
path: root/core/container
diff options
context:
space:
mode:
authorShane Shrybman <shrybman@teksavvy.com>2026-02-10 21:13:33 -0500
committerShane Shrybman <shrybman@teksavvy.com>2026-02-10 21:13:33 -0500
commit264029b2d6a02fe928aff1247f96dc1b55e3d35a (patch)
treed4ae675cea501f1f7fa29bbd6a5ad626d25c20bc /core/container
parentae91b9b3693f1ee5b39f14e38a67af5f502bc829 (diff)
Remove core:mem dependency from core:container/xar
Diffstat (limited to 'core/container')
-rw-r--r--core/container/xar/xar.odin11
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