}
if aa == .Resize {
- // An allocation of this size does not fit into a single arena.
- if size > alloc_arena.arena_size - sizeof rawptr {
- return null;
- }
-
newptr := arena_alloc_proc(data, .Alloc, size, align, oldptr);
+ if newptr == null do return null;
// This is incorrect, but because there is not an "old size",
// this is the best possible.
T.destroy(x_);
cfree(x_);
}
-
- #local
- IsNotDoublePointer :: interface (t: $T) {
- #not **t;
- }
-
- #overload #order 1001
- delete :: macro (x: &$T/core.intrinsics.types.type_is_simple)
- where IsNotDoublePointer(&T)
- {
- cfree(x);
- }
}
//
// Allows for delete(&sl);
#overload
-builtin.delete :: macro (x: &[] $T) {
- #this_package.free_slice(x);
+builtin.delete :: macro (x: &[] $T, allocator := context.allocator) {
+ #this_package.free_slice(x, allocator);
}