On Mon, 2012-04-02 at 11:28 +0300, Alok Barsode wrote:
> + for (i=0; service_ts != NULL && service_ts[i] != NULL; i++)
> + ts_list = g_slist_append(ts_list, g_strdup(service_ts[i]));
> +
> + timeservers = load_timeservers();
> +
> + for (i=0; timeservers != NULL && timeservers[i] != NULL; i++)
> + ts_list = g_slist_append(ts_list, g_strdup(timeservers[i]));
Please avoid appending to a single linked list. Use g_slist_prepend()
and then reverse the list when ready.
> + if (g_slist_length(ts_list) == 0) {
> + DBG("No timeservers set.");
> + return 0;
> + }
Faster to just check ts_list == NULL here. The code runs through the
list to count the number of list elements, which you are not interested
in anyway.
Cheers,
Patrik
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman