From 57fa40851534c3c9f2ca0267108a915cdc467c9e Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Wed, 31 Oct 2012 10:33:29 +0100 Subject: session: Pick directly first policy in list There is no point in iterating over the list when we always pick the first element in the list. --- src/session.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/session.c') diff --git a/src/session.c b/src/session.c index e4897424..c981befa 100644 --- a/src/session.c +++ b/src/session.c @@ -220,18 +220,13 @@ static char *service2bearer(enum connman_service_type type) static int assign_policy_plugin(struct connman_session *session) { - GSList *list; - struct connman_session_policy *policy; - if (session->policy != NULL) return -EALREADY; - for (list = policy_list; list != NULL; list = list->next) { - policy = list->data; + if (policy_list == NULL) + return 0; - session->policy = policy; - break; - } + session->policy = policy_list->data; return 0; } -- cgit v1.2.3