mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
Treap: do not set key to undefined in remove to allow re-use of removed nodes
This commit is contained in:
parent
cf3572a66b
commit
95f4c1532a
@ -913,8 +913,6 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type {
|
||||
// save the node for destruction/insertion into in empty_buckets
|
||||
var node = entry.node.?;
|
||||
entry.set(null);
|
||||
// restore the node's key since Treap.remove sets it to undefined
|
||||
node.key = bucket;
|
||||
if (self.cur_buckets[bucket_index] == bucket) {
|
||||
self.cur_buckets[bucket_index] = null;
|
||||
}
|
||||
|
||||
@ -225,7 +225,6 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type {
|
||||
link.* = null;
|
||||
|
||||
// clean up after ourselves
|
||||
node.key = undefined;
|
||||
node.priority = 0;
|
||||
node.parent = null;
|
||||
node.children = [_]?*Node{ null, null };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user