Return this from addref for Entry

This commit is contained in:
2024-05-01 17:24:48 -07:00
parent 791030dc3a
commit 26c66bcefb

View File

@@ -76,7 +76,10 @@ struct Entry {
return (const uint8_t *)(this + 1) + 1 + keyLen;
}
void addref() const { ++refCount; }
Entry *addref() const {
++refCount;
return (Entry *)this;
}
void delref() const {
if (--refCount == 0) {
@@ -420,8 +423,7 @@ struct VersionedMap::Impl {
auto doCopy = [&]() {
uint32_t copy = mm.allocate();
auto &c = mm.base[copy];
n.entry->addref();
c.entry = n.entry;
c.entry = n.entry->addref();
c.pointer[which] = child;
c.pointer[!which] = n.pointer[!which];
c.updated.store(false, std::memory_order_relaxed);