From 920b1d51e92253d429bd8f0f737fc02047a61201 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sat, 18 Feb 2017 11:48:25 -0500 Subject: [PATCH] Hide filter creation functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- .../component/component-filter-internal.h | 14 ++++++++ lib/component/filter.c | 34 ++----------------- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/include/babeltrace/component/component-filter-internal.h b/include/babeltrace/component/component-filter-internal.h index 1d4cc9a7..72bbbab1 100644 --- a/include/babeltrace/component/component-filter-internal.h +++ b/include/babeltrace/component/component-filter-internal.h @@ -59,4 +59,18 @@ BT_HIDDEN enum bt_component_status bt_component_filter_validate( struct bt_component *component); +/** + * Create an iterator on a component instance. + * + * @param component Component instance + * @returns Notification iterator instance + */ +BT_HIDDEN +struct bt_notification_iterator *bt_component_filter_create_notification_iterator( + struct bt_component *component); + +BT_HIDDEN +struct bt_notification_iterator *bt_component_filter_create_notification_iterator_with_init_method_data( + struct bt_component *component, void *init_method_data); + #endif /* BABELTRACE_COMPONENT_FILTER_INTERNAL_H */ diff --git a/lib/component/filter.c b/lib/component/filter.c index 23190709..da59cc21 100644 --- a/lib/component/filter.c +++ b/lib/component/filter.c @@ -34,44 +34,14 @@ #include #include -enum bt_component_status bt_component_filter_add_iterator( - struct bt_component *component, - struct bt_notification_iterator *iterator) -{ - enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_component_class_filter *filter_class; - - if (!component || !iterator) { - ret = BT_COMPONENT_STATUS_INVALID; - goto end; - } - - if (bt_component_get_class_type(component) != BT_COMPONENT_CLASS_TYPE_FILTER) { - ret = BT_COMPONENT_STATUS_UNSUPPORTED; - goto end; - } - - /* TODO validate iterator count limits. */ - - filter_class = container_of(component->class, - struct bt_component_class_filter, parent); - if (filter_class->methods.add_iterator) { - ret = filter_class->methods.add_iterator(component, iterator); - if (ret != BT_COMPONENT_STATUS_OK) { - goto end; - } - } - -end: - return ret; -} - +BT_HIDDEN struct bt_notification_iterator *bt_component_filter_create_notification_iterator( struct bt_component *component) { return bt_component_create_iterator(component, NULL); } +BT_HIDDEN struct bt_notification_iterator *bt_component_filter_create_notification_iterator_with_init_method_data( struct bt_component *component, void *init_method_data) { -- 2.34.1