From: Simon Marchi Date: Thu, 2 Nov 2023 19:33:18 +0000 (+0000) Subject: lib: remove unused internal component destroy functions X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=4e5771a6f6bfe3c97111f8c9d0518a0875b6152b;p=babeltrace.git lib: remove unused internal component destroy functions These destroy functions are empty, remove them. They can always be added back later if needed, but I don't see the value in keeping then "just in case". Change-Id: I5845d2834294583367c85a840b016a536bf0b120 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/11205 Reviewed-by: Philippe Proulx --- diff --git a/src/lib/graph/component-filter.c b/src/lib/graph/component-filter.c index 507ef2b5..fe6b6898 100644 --- a/src/lib/graph/component-filter.c +++ b/src/lib/graph/component-filter.c @@ -21,11 +21,6 @@ #include "component-class.h" #include "lib/func-status.h" -void bt_component_filter_destroy( - struct bt_component *component __attribute__((unused))) -{ -} - struct bt_component *bt_component_filter_create(void) { struct bt_component_filter *filter = NULL; diff --git a/src/lib/graph/component-filter.h b/src/lib/graph/component-filter.h index 4d90d5c9..091ef1b8 100644 --- a/src/lib/graph/component-filter.h +++ b/src/lib/graph/component-filter.h @@ -20,6 +20,4 @@ struct bt_component_filter { struct bt_component *bt_component_filter_create(void); -void bt_component_filter_destroy(struct bt_component *component); - #endif /* BABELTRACE_GRAPH_COMPONENT_FILTER_INTERNAL_H */ diff --git a/src/lib/graph/component-sink.c b/src/lib/graph/component-sink.c index adbc2699..af55ce42 100644 --- a/src/lib/graph/component-sink.c +++ b/src/lib/graph/component-sink.c @@ -21,11 +21,6 @@ #include "graph.h" #include "lib/func-status.h" -void bt_component_sink_destroy( - struct bt_component *component __attribute__((unused))) -{ -} - struct bt_component *bt_component_sink_create(void) { struct bt_component_sink *sink = NULL; diff --git a/src/lib/graph/component-sink.h b/src/lib/graph/component-sink.h index 59181549..7ed41fd9 100644 --- a/src/lib/graph/component-sink.h +++ b/src/lib/graph/component-sink.h @@ -24,6 +24,4 @@ struct bt_component_sink { struct bt_component *bt_component_sink_create(void); -void bt_component_sink_destroy(struct bt_component *component); - #endif /* BABELTRACE_GRAPH_COMPONENT_SINK_INTERNAL_H */ diff --git a/src/lib/graph/component-source.c b/src/lib/graph/component-source.c index 1007f478..096d2425 100644 --- a/src/lib/graph/component-source.c +++ b/src/lib/graph/component-source.c @@ -21,11 +21,6 @@ #include "message/iterator.h" #include "lib/func-status.h" -void bt_component_source_destroy( - struct bt_component *component __attribute__((unused))) -{ -} - struct bt_component *bt_component_source_create(void) { struct bt_component_source *source = NULL; diff --git a/src/lib/graph/component-source.h b/src/lib/graph/component-source.h index e6d7a643..693162d3 100644 --- a/src/lib/graph/component-source.h +++ b/src/lib/graph/component-source.h @@ -19,6 +19,4 @@ struct bt_component_source { struct bt_component *bt_component_source_create(void); -void bt_component_source_destroy(struct bt_component *component); - #endif /* BABELTRACE_GRAPH_COMPONENT_SOURCE_INTERNAL_H */ diff --git a/src/lib/graph/component.c b/src/lib/graph/component.c index e5584b0f..7b592b50 100644 --- a/src/lib/graph/component.c +++ b/src/lib/graph/component.c @@ -40,13 +40,6 @@ struct bt_component * (* const component_create_funcs[])(void) = { [BT_COMPONENT_CLASS_TYPE_FILTER] = bt_component_filter_create, }; -static -void (*component_destroy_funcs[])(struct bt_component *) = { - [BT_COMPONENT_CLASS_TYPE_SOURCE] = bt_component_source_destroy, - [BT_COMPONENT_CLASS_TYPE_SINK] = bt_component_sink_destroy, - [BT_COMPONENT_CLASS_TYPE_FILTER] = bt_component_filter_destroy, -}; - static void finalize_component(struct bt_component *comp) { @@ -147,11 +140,6 @@ void destroy_component(struct bt_object *obj) finalize_component(component); } - if (component->destroy) { - BT_LOGD_STR("Destroying type-specific data."); - component->destroy(component); - } - if (component->input_ports) { BT_LOGD_STR("Destroying input ports."); g_ptr_array_free(component->input_ports, TRUE); @@ -327,7 +315,6 @@ int bt_component_create(struct bt_component_class *component_class, bt_object_init_shared_with_parent(&component->base, destroy_component); component->class = component_class; bt_object_get_ref_no_null_check(component->class); - component->destroy = component_destroy_funcs[type]; component->name = g_string_new(name); if (!component->name) { BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one GString."); diff --git a/src/lib/graph/component.h b/src/lib/graph/component.h index a562d3d5..93546445 100644 --- a/src/lib/graph/component.h +++ b/src/lib/graph/component.h @@ -38,12 +38,6 @@ struct bt_component { GString *name; bt_logging_level log_level; - /* - * Internal destroy function specific to a source, filter, or - * sink component object. - */ - void (*destroy)(struct bt_component *); - /* User-defined data */ void *user_data;