fix queue reserve always doubling in size when there is enough space

This commit is contained in:
Laytan Laats
2023-08-26 19:09:04 +02:00
parent 39c0a619eb
commit 076b20a9a5
+1 -1
View File
@@ -56,7 +56,7 @@ space :: proc(q: $Q/Queue($T)) -> int {
// Reserve enough space for at least the specified capacity
reserve :: proc(q: ^$Q/Queue($T), capacity: int) -> runtime.Allocator_Error {
if uint(capacity) > q.len {
if capacity > space(q^) {
return _grow(q, uint(capacity))
}
return nil