From f615b25000172f8d9607039fe94a0662533e0394 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Sat, 11 Jan 2020 08:57:43 -0500 Subject: [PATCH] lib: remove self component param. from msg. iterator init. method Since a3f0c7db ("lib: introduce bt_message_iterator_class"), the `self_component` parameter of `bt_message_iterator_class_initialize_method` is useless because you can access the equivalent with bt_self_message_iterator_borrow_component(). Remove it. Signed-off-by: Philippe Proulx Change-Id: I81e967acfd99b6ef3a2e01ae2ee19008a3c60408 Reviewed-on: https://review.lttng.org/c/babeltrace/+/2761 Tested-by: jenkins Reviewed-by: Simon Marchi --- include/babeltrace2/graph/message-iterator-class.h | 1 - src/bindings/python/bt2/bt2/native_bt_component_class.i.h | 4 +++- src/lib/graph/iterator.c | 1 - src/plugins/ctf/fs-src/fs.c | 3 ++- src/plugins/ctf/fs-src/fs.h | 1 - src/plugins/ctf/lttng-live/lttng-live.c | 5 ++--- src/plugins/ctf/lttng-live/lttng-live.h | 1 - src/plugins/lttng-utils/debug-info/debug-info.c | 3 ++- src/plugins/lttng-utils/debug-info/debug-info.h | 1 - src/plugins/text/dmesg/dmesg.c | 3 ++- src/plugins/text/dmesg/dmesg.h | 1 - src/plugins/utils/muxer/muxer.c | 3 ++- src/plugins/utils/muxer/muxer.h | 1 - src/plugins/utils/trimmer/trimmer.c | 3 ++- src/plugins/utils/trimmer/trimmer.h | 1 - tests/lib/test-plugin-plugins/sfs.c | 2 -- 16 files changed, 15 insertions(+), 19 deletions(-) diff --git a/include/babeltrace2/graph/message-iterator-class.h b/include/babeltrace2/graph/message-iterator-class.h index c52fcd72..3ee9c0da 100644 --- a/include/babeltrace2/graph/message-iterator-class.h +++ b/include/babeltrace2/graph/message-iterator-class.h @@ -81,7 +81,6 @@ typedef bt_message_iterator_class_initialize_method_status (*bt_message_iterator_class_initialize_method)( bt_self_message_iterator *message_iterator, bt_self_message_iterator_configuration *config, - bt_self_component *self_component, bt_self_component_port_output *port); typedef void diff --git a/src/bindings/python/bt2/bt2/native_bt_component_class.i.h b/src/bindings/python/bt2/bt2/native_bt_component_class.i.h index 1f193685..f0ba0425 100644 --- a/src/bindings/python/bt2/bt2/native_bt_component_class.i.h +++ b/src/bindings/python/bt2/bt2/native_bt_component_class.i.h @@ -1083,7 +1083,6 @@ bt_message_iterator_class_initialize_method_status component_class_message_iterator_init( bt_self_message_iterator *self_message_iterator, bt_self_message_iterator_configuration *config, - bt_self_component *self_component, bt_self_component_port_output *self_component_port_output) { bt_message_iterator_class_initialize_method_status status = __BT_FUNC_STATUS_OK; @@ -1095,6 +1094,9 @@ component_class_message_iterator_init( PyObject *py_init_method_result = NULL; PyObject *py_iter = NULL; PyObject *py_comp; + bt_self_component *self_component = + bt_self_message_iterator_borrow_component( + self_message_iterator); bt_logging_level log_level = get_self_component_log_level( self_component); diff --git a/src/lib/graph/iterator.c b/src/lib/graph/iterator.c index c0ca8f86..61537319 100644 --- a/src/lib/graph/iterator.c +++ b/src/lib/graph/iterator.c @@ -427,7 +427,6 @@ int create_self_component_input_port_message_iterator( iter_status = init_method( (struct bt_self_message_iterator *) iterator, &iterator->config, - (struct bt_self_component *) upstream_comp, (struct bt_self_component_port_output *) upstream_port); BT_LOGD("User method returned: status=%s", bt_common_func_status_string(iter_status)); diff --git a/src/plugins/ctf/fs-src/fs.c b/src/plugins/ctf/fs-src/fs.c index a6712cb7..e87523a3 100644 --- a/src/plugins/ctf/fs-src/fs.c +++ b/src/plugins/ctf/fs-src/fs.c @@ -211,7 +211,6 @@ BT_HIDDEN bt_message_iterator_class_initialize_method_status ctf_fs_iterator_init( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *self_port) { struct ctf_fs_port_data *port_data; @@ -219,6 +218,8 @@ bt_message_iterator_class_initialize_method_status ctf_fs_iterator_init( bt_message_iterator_class_initialize_method_status status; bt_logging_level log_level; enum ctf_msg_iter_medium_status medium_status; + bt_self_component *self_comp = + bt_self_message_iterator_borrow_component(self_msg_iter); port_data = bt_self_component_port_get_data( bt_self_component_port_output_as_self_component_port( diff --git a/src/plugins/ctf/fs-src/fs.h b/src/plugins/ctf/fs-src/fs.h index 763136af..ef9cdaa4 100644 --- a/src/plugins/ctf/fs-src/fs.h +++ b/src/plugins/ctf/fs-src/fs.h @@ -225,7 +225,6 @@ BT_HIDDEN bt_message_iterator_class_initialize_method_status ctf_fs_iterator_init( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *self_port); BT_HIDDEN diff --git a/src/plugins/ctf/lttng-live/lttng-live.c b/src/plugins/ctf/lttng-live/lttng-live.c index 6d77035b..d812e818 100644 --- a/src/plugins/ctf/lttng-live/lttng-live.c +++ b/src/plugins/ctf/lttng-live/lttng-live.c @@ -1567,7 +1567,6 @@ BT_HIDDEN bt_message_iterator_class_initialize_method_status lttng_live_msg_iter_init( bt_self_message_iterator *self_msg_it, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *self_port) { bt_message_iterator_class_initialize_method_status status; @@ -1575,8 +1574,8 @@ bt_message_iterator_class_initialize_method_status lttng_live_msg_iter_init( struct lttng_live_msg_iter *lttng_live_msg_iter; enum lttng_live_viewer_status viewer_status; bt_logging_level log_level; - - BT_ASSERT(self_msg_it); + bt_self_component *self_comp = + bt_self_message_iterator_borrow_component(self_msg_it); lttng_live = bt_self_component_get_data(self_comp); log_level = lttng_live->log_level; diff --git a/src/plugins/ctf/lttng-live/lttng-live.h b/src/plugins/ctf/lttng-live/lttng-live.h index 39bc5abc..80c40de2 100644 --- a/src/plugins/ctf/lttng-live/lttng-live.h +++ b/src/plugins/ctf/lttng-live/lttng-live.h @@ -301,7 +301,6 @@ bt_message_iterator_class_next_method_status lttng_live_msg_iter_next( bt_message_iterator_class_initialize_method_status lttng_live_msg_iter_init( bt_self_message_iterator *self_msg_it, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *self_port); void lttng_live_msg_iter_finalize(bt_self_message_iterator *it); diff --git a/src/plugins/lttng-utils/debug-info/debug-info.c b/src/plugins/lttng-utils/debug-info/debug-info.c index 7b6ea383..36af5aa2 100644 --- a/src/plugins/lttng-utils/debug-info/debug-info.c +++ b/src/plugins/lttng-utils/debug-info/debug-info.c @@ -1984,7 +1984,6 @@ BT_HIDDEN bt_message_iterator_class_initialize_method_status debug_info_msg_iter_init( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *self_port) { bt_message_iterator_class_initialize_method_status status; @@ -1995,6 +1994,8 @@ bt_message_iterator_class_initialize_method_status debug_info_msg_iter_init( struct debug_info_msg_iter *debug_info_msg_iter = NULL; gchar *debug_info_field_name; int ret; + bt_self_component *self_comp = + bt_self_message_iterator_borrow_component(self_msg_iter); bt_logging_level log_level = bt_component_get_logging_level( bt_self_component_as_component(self_comp)); diff --git a/src/plugins/lttng-utils/debug-info/debug-info.h b/src/plugins/lttng-utils/debug-info/debug-info.h index 13fc0ff8..071ef379 100644 --- a/src/plugins/lttng-utils/debug-info/debug-info.h +++ b/src/plugins/lttng-utils/debug-info/debug-info.h @@ -50,7 +50,6 @@ BT_HIDDEN bt_message_iterator_class_initialize_method_status debug_info_msg_iter_init( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *self_port); BT_HIDDEN diff --git a/src/plugins/text/dmesg/dmesg.c b/src/plugins/text/dmesg/dmesg.c index 65718d32..50ceb7e6 100644 --- a/src/plugins/text/dmesg/dmesg.c +++ b/src/plugins/text/dmesg/dmesg.c @@ -665,9 +665,10 @@ BT_HIDDEN bt_message_iterator_class_initialize_method_status dmesg_msg_iter_init( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *self_port) { + bt_self_component *self_comp = + bt_self_message_iterator_borrow_component(self_msg_iter); struct dmesg_component *dmesg_comp = bt_self_component_get_data(self_comp); struct dmesg_msg_iter *dmesg_msg_iter = g_new0(struct dmesg_msg_iter, 1); diff --git a/src/plugins/text/dmesg/dmesg.h b/src/plugins/text/dmesg/dmesg.h index c73999ed..b94397e1 100644 --- a/src/plugins/text/dmesg/dmesg.h +++ b/src/plugins/text/dmesg/dmesg.h @@ -40,7 +40,6 @@ BT_HIDDEN bt_message_iterator_class_initialize_method_status dmesg_msg_iter_init( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *self_port); BT_HIDDEN diff --git a/src/plugins/utils/muxer/muxer.c b/src/plugins/utils/muxer/muxer.c index db8b86bd..2554d270 100644 --- a/src/plugins/utils/muxer/muxer.c +++ b/src/plugins/utils/muxer/muxer.c @@ -1276,12 +1276,13 @@ BT_HIDDEN bt_message_iterator_class_initialize_method_status muxer_msg_iter_init( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *port) { struct muxer_comp *muxer_comp = NULL; struct muxer_msg_iter *muxer_msg_iter = NULL; bt_message_iterator_class_initialize_method_status status; + bt_self_component *self_comp = + bt_self_message_iterator_borrow_component(self_msg_iter); muxer_comp = bt_self_component_get_data(self_comp); BT_ASSERT(muxer_comp); diff --git a/src/plugins/utils/muxer/muxer.h b/src/plugins/utils/muxer/muxer.h index aa9a21dd..f2036631 100644 --- a/src/plugins/utils/muxer/muxer.h +++ b/src/plugins/utils/muxer/muxer.h @@ -41,7 +41,6 @@ BT_HIDDEN bt_message_iterator_class_initialize_method_status muxer_msg_iter_init( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *self_port); BT_HIDDEN diff --git a/src/plugins/utils/trimmer/trimmer.c b/src/plugins/utils/trimmer/trimmer.c index 2fc365c9..e46884de 100644 --- a/src/plugins/utils/trimmer/trimmer.c +++ b/src/plugins/utils/trimmer/trimmer.c @@ -699,13 +699,14 @@ BT_HIDDEN bt_message_iterator_class_initialize_method_status trimmer_msg_iter_init( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *port) { bt_message_iterator_class_initialize_method_status status; bt_message_iterator_create_from_message_iterator_status msg_iter_status; struct trimmer_iterator *trimmer_it; + bt_self_component *self_comp = + bt_self_message_iterator_borrow_component(self_msg_iter); trimmer_it = g_new0(struct trimmer_iterator, 1); if (!trimmer_it) { diff --git a/src/plugins/utils/trimmer/trimmer.h b/src/plugins/utils/trimmer/trimmer.h index 678aca29..a7100b67 100644 --- a/src/plugins/utils/trimmer/trimmer.h +++ b/src/plugins/utils/trimmer/trimmer.h @@ -43,7 +43,6 @@ BT_HIDDEN bt_message_iterator_class_initialize_method_status trimmer_msg_iter_init( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *port); BT_HIDDEN diff --git a/tests/lib/test-plugin-plugins/sfs.c b/tests/lib/test-plugin-plugins/sfs.c index a425b7a7..4c0c7acb 100644 --- a/tests/lib/test-plugin-plugins/sfs.c +++ b/tests/lib/test-plugin-plugins/sfs.c @@ -28,7 +28,6 @@ static bt_message_iterator_class_initialize_method_status src_dummy_iterator_init_method( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *self_port) { return BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK; @@ -38,7 +37,6 @@ static bt_message_iterator_class_initialize_method_status flt_dummy_iterator_init_method( bt_self_message_iterator *self_msg_iter, bt_self_message_iterator_configuration *config, - bt_self_component *self_comp, bt_self_component_port_output *self_port) { return BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK; -- 2.34.1