From 7366bfe715619c5d9217bdd1d7f4be08194764cf Mon Sep 17 00:00:00 2001 From: Alok Barsode Date: Tue, 8 Feb 2011 15:03:41 +0200 Subject: [PATCH] technology: Optimize __connman_technology_add_interface() Instead of looping through the technology_list, using the technology pointer returned by technology_get(). --- src/technology.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/technology.c b/src/technology.c index 5ef3d10..0a89b1a 100644 --- a/src/technology.c +++ b/src/technology.c @@ -547,7 +547,7 @@ static void technology_put(struct connman_technology *technology) void __connman_technology_add_interface(enum connman_service_type type, int index, const char *name, const char *ident) { - GSList *list; + struct connman_technology *technology; switch (type) { case CONNMAN_SERVICE_TYPE_UNKNOWN: @@ -567,21 +567,14 @@ void __connman_technology_add_interface(enum connman_service_type type, connman_info("Create interface %s [ %s ]", name, __connman_service_type2string(type)); - technology_get(type); - - for (list = technology_list; list; list = list->next) { - struct connman_technology *technology = list->data; - - if (technology->type != type) - continue; + technology = technology_get(type); - if (technology->driver == NULL) - continue; + if (technology == NULL || technology->driver == NULL + || technology->driver->add_interface == NULL) + return; - if (technology->driver->add_interface) - technology->driver->add_interface(technology, - index, name, ident); - } + technology->driver->add_interface(technology, + index, name, ident); } void __connman_technology_remove_interface(enum connman_service_type type, -- 2.7.4