lib: remove useless checks, make functions inline on fast path
[babeltrace.git] / include / babeltrace / graph / notification-internal.h
index 243aac09cb1ffdfa40a8adf611060fe21128d56f..5b7ce5397c712e56046946c4308109e4d3e772a6 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/object-internal.h>
+#include <babeltrace/assert-internal.h>
 #include <babeltrace/graph/graph.h>
 #include <babeltrace/graph/notification.h>
 #include <babeltrace/ctf-ir/stream.h>
@@ -77,7 +78,7 @@ struct bt_notification *bt_notification_create_from_pool(
 {
        struct bt_notification *notif = bt_object_pool_create_object(pool);
 
-       if (!notif) {
+       if (unlikely(!notif)) {
 #ifdef BT_LIB_LOGE
                BT_LIB_LOGE("Cannot allocate one notification from notification pool: "
                        "%![pool-]+o, %![graph-]+g", pool, graph);
@@ -85,14 +86,14 @@ struct bt_notification *bt_notification_create_from_pool(
                goto error;
        }
 
-       if (!notif->graph) {
+       if (likely(!notif->graph)) {
                notif->graph = graph;
        }
 
        goto end;
 
 error:
-       BT_PUT(notif);
+       BT_ASSERT(!notif);
 
 end:
        return notif;
This page took 0.02553 seconds and 4 git commands to generate.