Rename <babeltrace/component/...> -> <babeltrace/graph/...>
[babeltrace.git] / plugins / text / text.c
index 5f833fe5ac22f091557d5d6ebfa57a2990361546..66b476e92f3052062b2ab5337155b0fd7d727dad 100644 (file)
  */
 
 #include <babeltrace/plugin/plugin-dev.h>
-#include <babeltrace/component/component.h>
-#include <babeltrace/component/private-component.h>
-#include <babeltrace/component/component-sink.h>
-#include <babeltrace/component/port.h>
-#include <babeltrace/component/private-port.h>
-#include <babeltrace/component/connection.h>
-#include <babeltrace/component/private-connection.h>
-#include <babeltrace/component/notification/notification.h>
-#include <babeltrace/component/notification/iterator.h>
-#include <babeltrace/component/notification/event.h>
+#include <babeltrace/graph/component.h>
+#include <babeltrace/graph/private-component.h>
+#include <babeltrace/graph/component-sink.h>
+#include <babeltrace/graph/port.h>
+#include <babeltrace/graph/private-port.h>
+#include <babeltrace/graph/connection.h>
+#include <babeltrace/graph/private-connection.h>
+#include <babeltrace/graph/notification.h>
+#include <babeltrace/graph/notification-iterator.h>
+#include <babeltrace/graph/notification-event.h>
 #include <babeltrace/values.h>
 #include <babeltrace/compiler.h>
 #include <babeltrace/common-internal.h>
@@ -109,7 +109,7 @@ error:
 }
 
 static
-void destroy_text(struct bt_private_component *component)
+void finalize_text(struct bt_private_component *component)
 {
        void *data = bt_private_component_get_user_data(component);
 
@@ -194,31 +194,25 @@ enum bt_component_status run(struct bt_private_component *component)
        struct bt_notification_iterator *it;
        struct text_component *text =
                bt_private_component_get_user_data(component);
+       enum bt_notification_iterator_status it_ret;
 
        it = text->input_iterator;
 
-       if (likely(text->processed_first_event)) {
-               enum bt_notification_iterator_status it_ret;
-
-               it_ret = bt_notification_iterator_next(it);
-               switch (it_ret) {
-               case BT_NOTIFICATION_ITERATOR_STATUS_ERROR:
-                       ret = BT_COMPONENT_STATUS_ERROR;
-                       goto end;
-               case BT_NOTIFICATION_ITERATOR_STATUS_END:
-                       ret = BT_COMPONENT_STATUS_END;
-                       BT_PUT(text->input_iterator);
-                       goto end;
-               default:
-                       break;
-               }
-       }
-       notification = bt_notification_iterator_get_notification(it);
-       if (!notification) {
+       it_ret = bt_notification_iterator_next(it);
+       switch (it_ret) {
+       case BT_NOTIFICATION_ITERATOR_STATUS_ERROR:
                ret = BT_COMPONENT_STATUS_ERROR;
                goto end;
+       case BT_NOTIFICATION_ITERATOR_STATUS_END:
+               ret = BT_COMPONENT_STATUS_END;
+               BT_PUT(text->input_iterator);
+               goto end;
+       default:
+               break;
        }
 
+       notification = bt_notification_iterator_get_notification(it);
+       assert(notification);
        ret = handle_notification(text, notification);
        text->processed_first_event = true;
 end:
@@ -767,6 +761,6 @@ BT_PLUGIN_LICENSE("MIT");
 BT_PLUGIN_SINK_COMPONENT_CLASS(text, run);
 BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD(text, text_component_init);
 BT_PLUGIN_SINK_COMPONENT_CLASS_ACCEPT_PORT_CONNECTION_METHOD(text, text_accept_port_connection);
-BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD(text, destroy_text);
+BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD(text, finalize_text);
 BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(text,
        "Formats CTF-IR to text. Formerly known as ctf-text.");
This page took 0.038974 seconds and 4 git commands to generate.