Make bt_private_connection_create_notification_iterator() return a status code
[babeltrace.git] / plugins / lttng-utils / plugin.c
index 1db6355b5d5e22c49f91718176a7f4a05e86d771..ec9c70adbf81d92cdae90b0149c7255b8d3796fa 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <babeltrace/graph/notification-iterator.h>
 #include <babeltrace/graph/private-notification-iterator.h>
+#include <babeltrace/graph/connection.h>
 #include <babeltrace/graph/notification.h>
 #include <babeltrace/graph/notification-event.h>
 #include <babeltrace/graph/notification-stream.h>
@@ -165,7 +166,6 @@ struct bt_notification *handle_notification(FILE *err,
                                writer_packet);
                assert(new_notification);
                bt_put(packet);
-               bt_put(writer_packet);
                break;
        }
        case BT_NOTIFICATION_TYPE_EVENT:
@@ -268,30 +268,6 @@ end:
        return ret;
 }
 
-/*
-static
-struct bt_notification *debug_info_iterator_get(
-               struct bt_private_notification_iterator *iterator)
-{
-       struct debug_info_iterator *debug_it;
-
-       debug_it = bt_private_notification_iterator_get_user_data(iterator);
-       assert(debug_it);
-
-       if (!debug_it->current_notification) {
-               enum bt_notification_iterator_status it_ret;
-
-               it_ret = debug_info_iterator_next(iterator);
-               if (it_ret) {
-                       goto end;
-               }
-       }
-
-end:
-       return bt_get(debug_it->current_notification);
-}
-*/
-
 static
 enum bt_notification_iterator_status debug_info_iterator_init(
                struct bt_private_notification_iterator *iterator,
@@ -300,6 +276,7 @@ enum bt_notification_iterator_status debug_info_iterator_init(
        enum bt_notification_iterator_status ret =
                BT_NOTIFICATION_ITERATOR_STATUS_OK;
        enum bt_notification_iterator_status it_ret;
+       enum bt_connection_status conn_status;
        struct bt_private_connection *connection = NULL;
        struct bt_private_component *component =
                bt_private_notification_iterator_get_private_component(iterator);
@@ -332,10 +309,10 @@ enum bt_notification_iterator_status debug_info_iterator_init(
                goto end;
        }
 
-       it_data->input_iterator = bt_private_connection_create_notification_iterator(
-                       connection, notif_types);
-       if (!it_data->input_iterator) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM;
+       conn_status = bt_private_connection_create_notification_iterator(
+                       connection, notif_types, &it_data->input_iterator);
+       if (conn_status != BT_CONNECTION_STATUS_OK) {
+               ret = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
                goto end;
        }
 
@@ -465,7 +442,6 @@ enum bt_component_status debug_info_component_init(
 {
        enum bt_component_status ret;
        struct debug_info_component *debug_info = create_debug_info_component_data();
-       struct bt_private_port *priv_port = NULL;
 
        if (!debug_info) {
                ret = BT_COMPONENT_STATUS_NOMEM;
@@ -477,21 +453,17 @@ enum bt_component_status debug_info_component_init(
                goto error;
        }
 
-       priv_port = bt_private_component_filter_add_input_private_port(
-               component, "in", NULL);
-       if (!priv_port) {
-               ret = BT_COMPONENT_STATUS_ERROR;
+       ret = bt_private_component_filter_add_input_private_port(
+               component, "in", NULL, NULL);
+       if (ret != BT_COMPONENT_STATUS_OK) {
                goto end;
        }
-       BT_PUT(priv_port);
 
-       priv_port = bt_private_component_filter_add_output_private_port(
-               component, "out", NULL);
-       if (!priv_port) {
-               ret = BT_COMPONENT_STATUS_ERROR;
+       ret = bt_private_component_filter_add_output_private_port(
+               component, "out", NULL, NULL);
+       if (ret != BT_COMPONENT_STATUS_OK) {
                goto end;
        }
-       BT_PUT(priv_port);
 
        ret = init_from_params(debug_info, params);
 end:
This page took 0.024569 seconds and 4 git commands to generate.