diff mbox series

[1/4] connection: Colocate search functions.

Message ID 20231129004759.1240786-2-gerickson@nuovations.com (mailing list archive)
State Superseded
Headers show
Series connection: Harmonize Search Function Names and Document Search Functions | expand

Commit Message

Grant Erickson Nov. 29, 2023, 12:47 a.m. UTC
This relocates 'find_active_gateway' and 'find_default_gateway' such
that they are colocated with other service/gateway map search
functions.
---
 src/connection.c | 70 ++++++++++++++++++++++++------------------------
 1 file changed, 35 insertions(+), 35 deletions(-)
diff mbox series

Patch

diff --git a/src/connection.c b/src/connection.c
index 499e8e46a5a5..7b73b48ab1ea 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -241,6 +241,41 @@  static struct gateway_data *lookup_gateway_data(struct gateway_config *config)
 	return NULL;
 }
 
+static struct gateway_data *find_active_gateway(void)
+{
+	GHashTableIter iter;
+	gpointer value, key;
+
+	DBG("");
+
+	g_hash_table_iter_init(&iter, gateway_hash);
+
+	while (g_hash_table_iter_next(&iter, &key, &value)) {
+		struct gateway_data *data = value;
+
+		if (data->ipv4_config &&
+				data->ipv4_config->active)
+			return data;
+
+		if (data->ipv6_config &&
+				data->ipv6_config->active)
+			return data;
+	}
+
+	return NULL;
+}
+
+static struct gateway_data *find_default_gateway(void)
+{
+	struct connman_service *service;
+
+	service = connman_service_get_default();
+	if (!service)
+		return NULL;
+
+	return g_hash_table_lookup(gateway_hash, service);
+}
+
 static struct gateway_data *find_vpn_gateway(int index, const char *gateway)
 {
 	GHashTableIter iter;
@@ -717,17 +752,6 @@  static void unset_default_gateway(struct gateway_data *data,
 						data->ipv4_config->gateway);
 }
 
-static struct gateway_data *find_default_gateway(void)
-{
-	struct connman_service *service;
-
-	service = connman_service_get_default();
-	if (!service)
-		return NULL;
-
-	return g_hash_table_lookup(gateway_hash, service);
-}
-
 static bool choose_default_gateway(struct gateway_data *data,
 					struct gateway_data *candidate)
 {
@@ -968,30 +992,6 @@  static struct connman_rtnl connection_rtnl = {
 	.delgateway	= connection_delgateway,
 };
 
-static struct gateway_data *find_active_gateway(void)
-{
-	GHashTableIter iter;
-	gpointer value, key;
-
-	DBG("");
-
-	g_hash_table_iter_init(&iter, gateway_hash);
-
-	while (g_hash_table_iter_next(&iter, &key, &value)) {
-		struct gateway_data *data = value;
-
-		if (data->ipv4_config &&
-				data->ipv4_config->active)
-			return data;
-
-		if (data->ipv6_config &&
-				data->ipv6_config->active)
-			return data;
-	}
-
-	return NULL;
-}
-
 static void add_host_route(int family, int index, const char *gateway,
 			enum connman_service_type service_type)
 {