void bt_ref_get(struct bt_ref *ref)
{
assert(ref);
+
+ if (unlikely(!ref->release)) {
+ return;
+ }
+
ref->count++;
/* Overflow check. */
assert(ref->count);
{
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);
}
}