This may look minor, but this is such a hot path, that this actually
speeds things up a bit.
_eo_unref(_Eo_Object *obj)
{
--(obj->refcount);
- if (obj->refcount == 0)
+ if (EINA_UNLIKELY(obj->refcount <= 0))
{
+ if (obj->refcount < 0)
+ {
+ ERR("Obj:%p. Refcount (%d) < 0. Too many unrefs.", obj, obj->refcount);
+ return;
+ }
+
if (obj->destructed)
{
ERR("Object %p already destructed.", _eo_id_get(obj));
else
_eo_ref(obj); /* If we manual free, we keep a phantom ref. */
}
- else if (obj->refcount < 0)
- {
- ERR("Obj:%p. Refcount (%d) < 0. Too many unrefs.", obj, obj->refcount);
- return;
- }
}
#endif