On Wed, 2010-06-30 at 11:41 +0200, Daniel Wagner wrote: > >> g_slist_remove and g_slist_length do nothing if NULL is passed in. > >> So it's not really necessary to check update_list, but I agree it's > >> more clear with a update_list != NULL. Do you still want me to add > >> it? > > > > Yes please. There is also a BKM somewhere that says that the NULL check > > is preferred instead checking for length equals zero. > > I just found out that g_slist_remove() will return NULL if it removes > the last element. So checking for NULL makes perfectly sense.
NULL is a valid GSList/GList, it's the empty list. So yes, checking that a list pointer is NULL is a must faster way of doing g_list_length (p) when you don't actually care about the length (because it iterates the list to calculate the length). Ross -- Intel Open Source Technology Centre http://oss.intel.com/
signature.asc
Description: This is a digitally signed message part
_______________________________________________ connman mailing list [email protected] http://lists.connman.net/listinfo/connman
