Function 'incStrong' and 'incWeak' both call 'addWeakRef' which is redundant.
void RefBase::incStrong(const void* id) const
{
weakref_impl* const refs = mRefs;
refs->addWeakRef(id);
refs->incWeak(id);
...
}
void RefBase::weakref_type::incWeak(const void* id)
{
weakref_impl* const impl = static_cast<weakref_impl*>(this);
impl->addWeakRef(id);
...
}
-------------------------------------------------------------------------------------------
Functions 'decStrong' and 'decWeak' invoke 'removeWeakRef' which again
is redundant.
void RefBase::decStrong(const void* id) const
{
weakref_impl* const refs = mRefs;
...
refs->removeWeakRef(id);
refs->decWeak(id);
}
void RefBase::weakref_type::decWeak(const void* id)
{
weakref_impl* const impl = static_cast<weakref_impl*>(this);
impl->removeWeakRef(id);
....
}
----------------------------------------------------------------------------------------------
Of course, there's no harm in these duplicate calls since these
functions are NOPs when DEBUG_REFS is 0.
Yet, these calls could be avoided.