mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-03 11:42:28 +00:00
Merge pull request #2771 from laytan/fix-queue-reserve
fix queue reserve always doubling in size when there is enough space
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user