Put Python plugin support in a separate shared object
[babeltrace.git] / include / babeltrace / ref-internal.h
index 3a8b39f4136139807ba6c207b77725fe8554a499..c5d8143a61caa1ac0202ffb379afe9337c5a4291 100644 (file)
@@ -50,12 +50,14 @@ static inline
 void bt_ref_get(struct bt_ref *ref)
 {
        assert(ref);
-       if (ref->release) {
-               /* Object has opted-in reference counting. */
-               ref->count++;
-               /* Overflow check. */
-               assert(ref->count);
+
+       if (unlikely(!ref->release)) {
+               return;
        }
+
+       ref->count++;
+       /* Overflow check. */
+       assert(ref->count);
 }
 
 static inline
@@ -63,7 +65,7 @@ void bt_ref_put(struct bt_ref *ref)
 {
        assert(ref);
        /* Only assert if the object has opted-in for reference counting. */
-       if ((--ref->count) == 0 && ref->release) {
+       if (unlikely((--ref->count) == 0 && ref->release)) {
                ref->release((struct bt_object *) ref);
        }
 }
This page took 0.023292 seconds and 4 git commands to generate.