diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 77880d2..0cf6134 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -803,8 +803,9 @@ Node *nextLogical(Node *node) { // Invalidates `self`, replacing it with a node of at least capacity. // Does not return nodes to freelists when kUseFreeList is false. template -void makeCapacityAtLeast(Node *&self, int capacity, NodeAllocators *allocators, - ConflictSet::Impl *impl) { +void freeAndMakeCapacityAtLeast(Node *&self, int capacity, + NodeAllocators *allocators, + ConflictSet::Impl *impl) { switch (self->type) { case Type_Node0: { auto *self0 = (Node0 *)self; @@ -915,8 +916,8 @@ void maybeDecreaseCapacity(Node *&self, NodeAllocators *allocators, if (self->partialKeyCapacity <= maxCapacity) { return; } - makeCapacityAtLeast(self, maxCapacity, allocators, - impl); + freeAndMakeCapacityAtLeast(self, maxCapacity, + allocators, impl); } // TODO fuse into erase child so we don't need to repeat branches on type @@ -947,8 +948,8 @@ void maybeDownsize(Node *self, NodeAllocators *allocators, if (minCapacity > child->partialKeyCapacity) { const bool update = child == dontInvalidate; - makeCapacityAtLeast(child, minCapacity, - allocators, impl); + freeAndMakeCapacityAtLeast(child, minCapacity, + allocators, impl); if (update) { dontInvalidate = child; }