mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Remove resize. Adding uninitialized memory at the end of the items would break the heap property.
This commit is contained in:
parent
9a09ebb1b9
commit
5bfd9238de
2 changed files with 0 additions and 10 deletions
|
|
@ -377,11 +377,6 @@ pub fn PriorityDequeue(comptime T: type) type {
|
|||
self.items = try self.allocator.realloc(self.items, better_capacity);
|
||||
}
|
||||
|
||||
pub fn resize(self: *Self, new_len: usize) !void {
|
||||
try self.ensureCapacity(new_len);
|
||||
self.len = new_len;
|
||||
}
|
||||
|
||||
/// Reduce allocated capacity to `new_len`.
|
||||
pub fn shrinkAndFree(self: *Self, new_len: usize) void {
|
||||
assert(new_len <= self.items.len);
|
||||
|
|
|
|||
|
|
@ -187,11 +187,6 @@ pub fn PriorityQueue(comptime T: type) type {
|
|||
self.items = try self.allocator.realloc(self.items, better_capacity);
|
||||
}
|
||||
|
||||
pub fn resize(self: *Self, new_len: usize) !void {
|
||||
try self.ensureCapacity(new_len);
|
||||
self.len = new_len;
|
||||
}
|
||||
|
||||
/// Reduce allocated capacity to `new_len`.
|
||||
pub fn shrinkAndFree(self: *Self, new_len: usize) void {
|
||||
assert(new_len <= self.items.len);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue