There is no point in iterating over the list when we always
pick the first element in the list.
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;
}