GNOME Bugzilla – Bug 360121
Bad glist usage, use g_list_prepend instead
Last modified: 2006-10-06 20:03:15 UTC
in gossip_contact_copy: for (l = priv->groups; l; l = l->next) { new_priv->groups = g_list_append (new_priv->groups, g_strdup (l->data)); } for (l = priv->presences; l; l = l->next) { new_priv->presences = g_list_append (new_priv->presences, g_strdup (l->data)); } should instead do for (...) g_list_prepend and then at the end g_list_reverse
Hi Paolo :) You are right of course. Good catch, I will fix this at some point this week when I get time, thanks.
If you have more than 10 groups, your group usage is very inefficient. Seriously, this is a bit silly :)
sure, but I was having fun serching for silly bugs with google codesearch and this was on the first page of http://www.google.com/codesearch?q=for+g_list_append&btnG=Search+Code :)
Actually, you have a good point. People do tend to look at code and copy and paste it so we could set a good example even if it's a bit silly to try and optimize when there is no need. Silly-comment withdrawn ;)
Thank Paolo, and thanks Google for bringing this to our attention :D