mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
fix bytes.buffer_init_allocator not using given allocator if len/cap is 0
This commit is contained in:
@@ -38,6 +38,11 @@ buffer_init_string :: proc(b: ^Buffer, s: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buffer_init_allocator :: proc(b: ^Buffer, len, cap: int, allocator := context.allocator) {
|
buffer_init_allocator :: proc(b: ^Buffer, len, cap: int, allocator := context.allocator) {
|
||||||
|
if b.buf == nil {
|
||||||
|
b.buf = make([dynamic]byte, len, cap, allocator)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
b.buf.allocator = allocator
|
b.buf.allocator = allocator
|
||||||
reserve(&b.buf, cap)
|
reserve(&b.buf, cap)
|
||||||
resize(&b.buf, len)
|
resize(&b.buf, len)
|
||||||
|
|||||||
Reference in New Issue
Block a user