Simplify insert loop
This commit is contained in:
@@ -2798,22 +2798,12 @@ Node **insert(Node **self, std::span<const uint8_t> key,
|
|||||||
assert(maxVersion(*self, impl) <= writeVersion);
|
assert(maxVersion(*self, impl) <= writeVersion);
|
||||||
setMaxVersion(*self, impl, writeVersion);
|
setMaxVersion(*self, impl, writeVersion);
|
||||||
|
|
||||||
for (;; ++tls->accum.insert_iterations) {
|
for (; key.size() != 0; ++tls->accum.insert_iterations) {
|
||||||
|
self = &getOrCreateChild(*self, key, writeVersion, tls);
|
||||||
if (key.size() == 0) {
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool existed = getChild(*self, key.front());
|
|
||||||
auto &child = getOrCreateChild(*self, key, writeVersion, tls);
|
|
||||||
if (!existed) {
|
|
||||||
return &child;
|
|
||||||
}
|
|
||||||
|
|
||||||
self = &child;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroyTree(Node *root) {
|
void destroyTree(Node *root) {
|
||||||
Arena arena;
|
Arena arena;
|
||||||
auto toFree = vector<Node *>(arena);
|
auto toFree = vector<Node *>(arena);
|
||||||
|
Reference in New Issue
Block a user