From: Alok Barsode Date: Mon, 7 Feb 2011 12:43:06 +0000 (+0200) Subject: technology: Optimize __connman_technology_remove_interface() X-Git-Tag: 0.70~48 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a849fe93e84edcc0fc6a3c88fbbf8bf6386a104;p=platform%2Fupstream%2Fconnman.git technology: Optimize __connman_technology_remove_interface() Using technology_find() instead of looping through technology_list. --- diff --git a/src/technology.c b/src/technology.c index 0a89b1a..a5366dc 100644 --- a/src/technology.c +++ b/src/technology.c @@ -580,7 +580,7 @@ void __connman_technology_add_interface(enum connman_service_type type, void __connman_technology_remove_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: @@ -600,20 +600,15 @@ void __connman_technology_remove_interface(enum connman_service_type type, connman_info("Remove interface %s [ %s ]", name, __connman_service_type2string(type)); - for (list = technology_list; list; list = list->next) { - struct connman_technology *technology = list->data; - - if (technology->type != type) - continue; + technology = technology_find(type); - if (technology->driver == NULL) - continue; + if (technology == NULL || technology->driver == NULL) + return; - if (technology->driver->remove_interface) - technology->driver->remove_interface(technology, index); + if (technology->driver->remove_interface) + technology->driver->remove_interface(technology, index); - technology_put(technology); - } + technology_put(technology); } static void unregister_technology(gpointer data)