From: Simon McVittie Date: Fri, 17 Aug 2018 15:30:23 +0000 (+0100) Subject: bus_connections_foreach, bus_connections_foreach_active: Remove X-Git-Tag: dbus-1.13.8~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=170adbd6afefc9056381d48ae482c90ba4796cfd;p=thirdparty%2Fdbus.git bus_connections_foreach, bus_connections_foreach_active: Remove These do not appear in code coverage statistics, and `git grep` reveals that they are unused. Signed-off-by: Simon McVittie Reviewed-by: Philip Withnall Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107739 --- diff --git a/bus/connection.c b/bus/connection.c index 35f8e36ef..25826b1bb 100644 --- a/bus/connection.c +++ b/bus/connection.c @@ -1148,86 +1148,6 @@ bus_connection_get_policy (DBusConnection *connection) return d->policy; } -static dbus_bool_t -foreach_active (BusConnections *connections, - BusConnectionForeachFunction function, - void *data) -{ - DBusList *link; - - link = _dbus_list_get_first_link (&connections->completed); - while (link != NULL) - { - DBusConnection *connection = link->data; - DBusList *next = _dbus_list_get_next_link (&connections->completed, link); - - if (!(* function) (connection, data)) - return FALSE; - - link = next; - } - - return TRUE; -} - -static dbus_bool_t -foreach_inactive (BusConnections *connections, - BusConnectionForeachFunction function, - void *data) -{ - DBusList *link; - - link = _dbus_list_get_first_link (&connections->incomplete); - while (link != NULL) - { - DBusConnection *connection = link->data; - DBusList *next = _dbus_list_get_next_link (&connections->incomplete, link); - - if (!(* function) (connection, data)) - return FALSE; - - link = next; - } - - return TRUE; -} - -/** - * Calls function on each active connection; if the function returns - * #FALSE, stops iterating. Active connections are authenticated - * and have sent a Hello message. - * - * @param connections the connections object - * @param function the function - * @param data data to pass to it as a second arg - */ -void -bus_connections_foreach_active (BusConnections *connections, - BusConnectionForeachFunction function, - void *data) -{ - foreach_active (connections, function, data); -} - -/** - * Calls function on each connection; if the function returns - * #FALSE, stops iterating. - * - * @param connections the connections object - * @param function the function - * @param data data to pass to it as a second arg - */ -void -bus_connections_foreach (BusConnections *connections, - BusConnectionForeachFunction function, - void *data) -{ - if (!foreach_active (connections, function, data)) - return; - - foreach_inactive (connections, function, data); -} - BusContext* bus_connections_get_context (BusConnections *connections) { diff --git a/bus/connection.h b/bus/connection.h index 736a3b28d..ad3fa8a3c 100644 --- a/bus/connection.h +++ b/bus/connection.h @@ -34,21 +34,11 @@ typedef enum BUS_EXTRA_HEADERS_NONE = 0 } BusExtraHeaders; -typedef dbus_bool_t (* BusConnectionForeachFunction) (DBusConnection *connection, - void *data); - - BusConnections* bus_connections_new (BusContext *context); BusConnections* bus_connections_ref (BusConnections *connections); void bus_connections_unref (BusConnections *connections); dbus_bool_t bus_connections_setup_connection (BusConnections *connections, DBusConnection *connection); -void bus_connections_foreach (BusConnections *connections, - BusConnectionForeachFunction function, - void *data); -void bus_connections_foreach_active (BusConnections *connections, - BusConnectionForeachFunction function, - void *data); BusContext* bus_connections_get_context (BusConnections *connections); void bus_connections_increment_stamp (BusConnections *connections); dbus_bool_t bus_connections_reload_policy (BusConnections *connections, diff --git a/bus/test.h b/bus/test.h index 38b74e89c..5b0fe0857 100644 --- a/bus/test.h +++ b/bus/test.h @@ -30,6 +30,9 @@ #include #include "connection.h" +typedef dbus_bool_t (* BusConnectionForeachFunction) (DBusConnection *connection, + void *data); + dbus_bool_t bus_dispatch_test (const DBusString *test_data_dir); dbus_bool_t bus_dispatch_sha1_test (const DBusString *test_data_dir); dbus_bool_t bus_config_parser_test (const DBusString *test_data_dir);