summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-10-15 17:51:20 +0100
committerTom Hacohen <tom@stosb.com>2015-10-19 10:22:41 +0100
commit37c07b07d492a37185b0e5dc404a6efa03c4ad16 (patch)
treefcd6e8b27eb349233ff0489f0ef95db3872841b9 /src
parentb0576a04fd5a3e21dfc85298ec0c4c9969765a02 (diff)
Eo unref: Decrease amount of checks and hint branch prediction.
This may look minor, but this is such a hot path, that this actually speeds things up a bit.
Diffstat (limited to 'src')
-rw-r--r--src/lib/eo/eo_private.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h
index 579ac6d..135966d 100644
--- a/src/lib/eo/eo_private.h
+++ b/src/lib/eo/eo_private.h
@@ -277,8 +277,14 @@ static inline void
277_eo_unref(_Eo_Object *obj) 277_eo_unref(_Eo_Object *obj)
278{ 278{
279 --(obj->refcount); 279 --(obj->refcount);
280 if (obj->refcount == 0) 280 if (EINA_UNLIKELY(obj->refcount <= 0))
281 { 281 {
282 if (obj->refcount < 0)
283 {
284 ERR("Obj:%p. Refcount (%d) < 0. Too many unrefs.", obj, obj->refcount);
285 return;
286 }
287
282 if (obj->destructed) 288 if (obj->destructed)
283 { 289 {
284 ERR("Object %p already destructed.", _eo_id_get(obj)); 290 ERR("Object %p already destructed.", _eo_id_get(obj));
@@ -320,11 +326,6 @@ _eo_unref(_Eo_Object *obj)
320 else 326 else
321 _eo_ref(obj); /* If we manual free, we keep a phantom ref. */ 327 _eo_ref(obj); /* If we manual free, we keep a phantom ref. */
322 } 328 }
323 else if (obj->refcount < 0)
324 {
325 ERR("Obj:%p. Refcount (%d) < 0. Too many unrefs.", obj, obj->refcount);
326 return;
327 }
328} 329}
329 330
330#endif 331#endif