0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-02-27 06:00:16 +01:00

ircd::ctx: Minor cleanup for promise/future list traversal; remove mutable_cast.

This commit is contained in:
Jason Volk 2019-09-04 15:34:02 -07:00
parent 9e69dff5dd
commit 01c364cc24

View file

@ -2069,7 +2069,7 @@ ircd::ctx::promise_base::refcount(const shared_state_base &st)
if(!is(st, future_state::PENDING)) if(!is(st, future_state::PENDING))
return ret; return ret;
for(const auto *next(head(mutable_cast(st))); next; next = next->next) for(const auto *next(head(st)); next; next = next->next)
++ret; ++ret;
return ret; return ret;
@ -2129,10 +2129,10 @@ ircd::ctx::remove(promise_base &p)
} }
if(last) if(last)
for(auto *next{last->next}; next; last = next, next = last->next) for(auto *next{last->next}; next; last = next, next = next->next)
if(next == &p) if(next == &p)
{ {
last->next = p.next; last->next = next->next;
break; break;
} }
@ -2377,7 +2377,7 @@ noexcept
{ {
const auto refcount const auto refcount
{ {
this->refcount(*this) shared_state_base::refcount(*this)
}; };
assert(refcount >= 1); assert(refcount >= 1);
@ -2481,10 +2481,10 @@ ircd::ctx::remove(shared_state_base &st)
} }
assert(last); assert(last);
for(auto *next(last->next); next; last = next, next = last->next) for(auto *next(last->next); next; last = next, next = next->next)
if(next == &st) if(next == &st)
{ {
last->next = st.next; last->next = next->next;
break; break;
} }