From 9029835781174a8246aca6ecc328ac0d2a268674 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 6 Sep 2016 16:11:57 -0400 Subject: [PATCH] Add reading loop to babeltrace binary MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- converter/babeltrace.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/converter/babeltrace.c b/converter/babeltrace.c index cd7bd7c4..36db88d1 100644 --- a/converter/babeltrace.c +++ b/converter/babeltrace.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -201,6 +202,7 @@ int main(int argc, char **argv) struct bt_component_class *source_class = NULL, *sink_class = NULL; struct bt_component *source = NULL, *sink = NULL; struct bt_value *source_params = NULL, *sink_params = NULL; + struct bt_notification_iterator *it = NULL; ret = parse_options(argc, argv); if (ret < 0) { @@ -280,6 +282,19 @@ int main(int argc, char **argv) goto end; } + it = bt_component_source_create_iterator(source); + if (!it) { + fprintf(stderr, "Failed to instantiate source iterator. Aborting...\n"); + ret = -1; + goto end; + } + + do { + struct bt_notification *notification = + bt_notification_iterator_get_notification(it); + BT_PUT(notification); + } while (bt_notification_iterator_next(it) == + BT_NOTIFICATION_ITERATOR_STATUS_OK); /* teardown and exit */ end: BT_PUT(component_factory); @@ -289,5 +304,6 @@ end: BT_PUT(sink); BT_PUT(source_params); BT_PUT(sink_params); + BT_PUT(it); return ret ? 1 : 0; } -- 2.34.1