diff options
| author | Erik Arvstedt <erik.arvstedt@gmail.com> | 2023-06-12 22:21:31 +0200 |
|---|---|---|
| committer | Erik Arvstedt <erik.arvstedt@gmail.com> | 2023-06-13 09:48:51 +0200 |
| commit | 89bd29a9058eabf23c735761c49809bb63a68842 (patch) | |
| tree | ff4248f657d3a71f335f0648dc8df947ef90e253 /src/Module.zig | |
| parent | 5d3c8f4913884a4503e9f183e471b6090bb5bc92 (diff) | |
| download | zig-89bd29a9058eabf23c735761c49809bb63a68842.tar.gz zig-89bd29a9058eabf23c735761c49809bb63a68842.zip | |
arena_allocator/reset: avoid zero-capacity allocations
1. When the arena is already empty, resetting with `retain_capacity` no longer
results in allocating a buffer with zero capacity.
This behavior was previously intended by the `(current_capacity == 0)` check,
but wasn't correctly implemented.
2. Resetting with `.{ .retain_with_limit = 0 }` is now equivalent to
`free_all` and a new buffer with zero capacity is no longer created.
This is a useful side-effect of the above fixes.
Diffstat (limited to 'src/Module.zig')
0 files changed, 0 insertions, 0 deletions
