Revert "Merge pull request #1177 from Kelimion/new_clone"

This reverts commit efa513262e, reversing
changes made to daccfca11d.
This commit is contained in:
Jeroen van Rijn
2021-09-19 22:16:02 +02:00
parent efa513262e
commit bf15e63130
5 changed files with 8 additions and 451 deletions
+4 -5
View File
@@ -215,14 +215,13 @@ new_aligned :: proc($T: typeid, alignment: int, allocator := context.allocator,
t = (^T)(raw_data(data))
return
}
new_clone :: proc(data: $T, allocator := context.allocator, loc := #caller_location) -> (t: ^T, err: Allocator_Error) {
backing := alloc_bytes(size_of(T), align_of(T), allocator, loc) or_return
t = (^T)(raw_data(backing))
new_clone :: proc(data: $T, allocator := context.allocator, loc := #caller_location) -> ^T {
data := alloc_bytes(size_of(T), alignment, allocator, loc) or_return
t = (^T)(raw_data(data))
if t != nil {
t^ = data
return t, nil
}
return nil, .Out_Of_Memory
return
}
DEFAULT_RESERVE_CAPACITY :: 16