Return this
from addref for Entry
This commit is contained in:
@@ -76,7 +76,10 @@ struct Entry {
|
|||||||
return (const uint8_t *)(this + 1) + 1 + keyLen;
|
return (const uint8_t *)(this + 1) + 1 + keyLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addref() const { ++refCount; }
|
Entry *addref() const {
|
||||||
|
++refCount;
|
||||||
|
return (Entry *)this;
|
||||||
|
}
|
||||||
|
|
||||||
void delref() const {
|
void delref() const {
|
||||||
if (--refCount == 0) {
|
if (--refCount == 0) {
|
||||||
@@ -420,8 +423,7 @@ struct VersionedMap::Impl {
|
|||||||
auto doCopy = [&]() {
|
auto doCopy = [&]() {
|
||||||
uint32_t copy = mm.allocate();
|
uint32_t copy = mm.allocate();
|
||||||
auto &c = mm.base[copy];
|
auto &c = mm.base[copy];
|
||||||
n.entry->addref();
|
c.entry = n.entry->addref();
|
||||||
c.entry = n.entry;
|
|
||||||
c.pointer[which] = child;
|
c.pointer[which] = child;
|
||||||
c.pointer[!which] = n.pointer[!which];
|
c.pointer[!which] = n.pointer[!which];
|
||||||
c.updated.store(false, std::memory_order_relaxed);
|
c.updated.store(false, std::memory_order_relaxed);
|
||||||
|
Reference in New Issue
Block a user