Fix writer: missing put ref to values and types
[babeltrace.git] / plugins / writer / writer.c
index ae01e5550476d900f9c9d6243bcd3128719b705f..f89ac7460a80f56e5d5f5eba0c48f972bc2b4519 100644 (file)
 
 #include <babeltrace/ctf-ir/packet.h>
 #include <babeltrace/plugin/plugin-dev.h>
-#include <babeltrace/component/component.h>
-#include <babeltrace/component/component-sink.h>
-#include <babeltrace/component/port.h>
-#include <babeltrace/component/connection.h>
-#include <babeltrace/component/notification/notification.h>
-#include <babeltrace/component/notification/iterator.h>
-#include <babeltrace/component/notification/event.h>
-#include <babeltrace/component/notification/packet.h>
+#include <babeltrace/graph/component.h>
+#include <babeltrace/graph/private-component.h>
+#include <babeltrace/graph/component-sink.h>
+#include <babeltrace/graph/private-component-sink.h>
+#include <babeltrace/graph/private-port.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/graph/notification-packet.h>
 #include <plugins-common.h>
 #include <stdio.h>
 #include <stdbool.h>
@@ -55,10 +57,10 @@ void destroy_writer_component_data(struct writer_component *writer_component)
 }
 
 static
-void destroy_writer_component(struct bt_component *component)
+void finalize_writer_component(struct bt_private_component *component)
 {
        struct writer_component *writer_component = (struct writer_component *)
-               bt_component_get_private_data(component);
+               bt_private_component_get_user_data(component);
 
        destroy_writer_component_data(writer_component);
        g_free(writer_component);
@@ -186,19 +188,21 @@ end:
 
 static
 enum bt_component_status writer_component_accept_port_connection(
-               struct bt_component *component, struct bt_port *self_port)
+               struct bt_private_component *component,
+               struct bt_private_port *self_port,
+               struct bt_port *other_port)
 {
        enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
-       struct bt_connection *connection;
+       struct bt_private_connection *connection;
        struct writer_component *writer;
 
-       writer = bt_component_get_private_data(component);
+       writer = bt_private_component_get_user_data(component);
        assert(writer);
        assert(!writer->input_iterator);
-       connection = bt_port_get_connection(self_port);
+       connection = bt_private_port_get_private_connection(self_port);
        assert(connection);
-        writer->input_iterator = bt_connection_create_notification_iterator(
-                       connection);
+        writer->input_iterator =
+               bt_private_connection_create_notification_iterator(connection);
 
        if (!writer->input_iterator) {
                ret = BT_COMPONENT_STATUS_ERROR;
@@ -208,14 +212,14 @@ enum bt_component_status writer_component_accept_port_connection(
 }
 
 static
-enum bt_component_status run(struct bt_component *component)
+enum bt_component_status run(struct bt_private_component *component)
 {
        enum bt_component_status ret;
        enum bt_notification_iterator_status it_status;
        struct bt_notification *notification = NULL;
        struct bt_notification_iterator *it;
        struct writer_component *writer_component =
-               bt_component_get_private_data(component);
+               bt_private_component_get_user_data(component);
 
        it = writer_component->input_iterator;
        assert(it);
@@ -241,7 +245,7 @@ end:
 
 static
 enum bt_component_status writer_component_init(
-       struct bt_component *component, struct bt_value *params,
+       struct bt_private_component *component, struct bt_value *params,
        UNUSED_VAR void *init_method_data)
 {
        enum bt_component_status ret;
@@ -268,6 +272,7 @@ enum bt_component_status writer_component_init(
                ret = BT_COMPONENT_STATUS_INVALID;
                goto error;
        }
+       bt_put(value);
 
        writer_component->base_path = g_string_new(path);
        if (!writer_component) {
@@ -275,7 +280,7 @@ enum bt_component_status writer_component_init(
                goto error;
        }
 
-       ret = bt_component_set_private_data(component, writer_component);
+       ret = bt_private_component_set_user_data(component, writer_component);
        if (ret != BT_COMPONENT_STATUS_OK) {
                goto error;
        }
@@ -297,5 +302,5 @@ BT_PLUGIN_SINK_COMPONENT_CLASS(writer, run);
 BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD(writer, writer_component_init);
 BT_PLUGIN_SINK_COMPONENT_CLASS_ACCEPT_PORT_CONNECTION_METHOD(writer,
                writer_component_accept_port_connection);
-BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD(writer, destroy_writer_component);
+BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD(writer, finalize_writer_component);
 BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(writer, "Formats CTF-IR to CTF.");
This page took 0.024493 seconds and 4 git commands to generate.