Accomodate component destructor API changes in text plugin
[babeltrace.git] / plugins / text / text.c
index a126b6f0fa5c2c6d8a5cd6ec0259ed8cfdd0bd1b..a269fe160742c1cfa49a435a258f50c662f365ee 100644 (file)
@@ -99,13 +99,17 @@ struct text_component *create_text(void)
        return g_new0(struct text_component, 1);
 }
 
-static void destroy_text(struct text_component *text)
+static
+void destroy_text_data(struct text_component *data)
 {
-       if (!text) {
-               return;
-       }
+       g_free(data);
+}
 
-       g_free(text);
+static void destroy_text(struct bt_component *component)
+{
+       void *data = bt_component_get_private_data(component);
+
+       destroy_text_data(data);
 }
 
 static
@@ -128,7 +132,7 @@ enum bt_component_status text_component_init(
        }
 
        ret = bt_component_set_destroy_cb(component,
-                       (bt_component_destroy_cb) destroy_text);
+                       destroy_text);
        if (ret != BT_COMPONENT_STATUS_OK) {
                goto error;
        }
@@ -139,18 +143,17 @@ enum bt_component_status text_component_init(
        }
 
        ret = bt_component_sink_set_handle_notification_cb(component,
-               handle_notification);
+                       handle_notification);
        if (ret != BT_COMPONENT_STATUS_OK) {
                goto error;
        }
 end:
        return ret;
 error:
-       destroy_text(text);
+       destroy_text_data(text);
        return ret;
 }
 
-
 /* Initialize plug-in entry points. */
 BT_PLUGIN_NAME("ctf-text");
 BT_PLUGIN_DESCRIPTION("Babeltrace text output plug-in.");
This page took 0.02568 seconds and 4 git commands to generate.