X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Ftext%2Ftext.c;h=9a31041e0d0e2746de86ab29d871df7e8d92110c;hb=56a1ccedd4a58b6c87d1bbd94e22094ad5ac1a98;hp=cdd92fd868d6be42d5d2619a44bbb6eac1888e7b;hpb=bac67f0fcc3e25ef8e77dbd44c00e823e3f685f4;p=babeltrace.git diff --git a/plugins/text/text.c b/plugins/text/text.c index cdd92fd8..9a31041e 100644 --- a/plugins/text/text.c +++ b/plugins/text/text.c @@ -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 @@ -127,7 +131,8 @@ enum bt_component_status text_component_init( goto end; } - ret = bt_component_set_destroy_cb(component, destroy_text); + ret = bt_component_set_destroy_cb(component, + destroy_text); if (ret != BT_COMPONENT_STATUS_OK) { goto error; } @@ -138,20 +143,19 @@ 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_NAME("text"); BT_PLUGIN_DESCRIPTION("Babeltrace text output plug-in."); BT_PLUGIN_AUTHOR("Jérémie Galarneau"); BT_PLUGIN_LICENSE("MIT");