diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-10-31 10:33:29 +0100 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-11-05 14:40:58 +0200 |
commit | 57fa40851534c3c9f2ca0267108a915cdc467c9e (patch) | |
tree | adfefb82374b7f1ccf235c44645be4710d0d2611 /src/session.c | |
parent | 66fe286e81325fc6a30f6cd4982574b93e7f2a4c (diff) | |
download | connman-57fa40851534c3c9f2ca0267108a915cdc467c9e.tar.gz connman-57fa40851534c3c9f2ca0267108a915cdc467c9e.tar.bz2 connman-57fa40851534c3c9f2ca0267108a915cdc467c9e.zip |
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.
Diffstat (limited to 'src/session.c')
-rw-r--r-- | src/session.c | 11 |
1 files changed, 3 insertions, 8 deletions
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; } |