GNOME Bugzilla – Bug 335375
bad use of GList in stickynotes applet
Last modified: 2010-01-24 01:06:14 UTC
despite its innocent look, the following code is *not* a good idea: for (i = 0; i < g_list_length(stickynotes->notes) && !inconsistent; i++) { StickyNote *note = g_list_nth_data(stickynotes->notes, i); using the good old for (l = stickynotes->notes; l != NULL && !inconsistent; l = l->next) { StickyNote *note = l->data avoids N^3 behavior. (not sure it's measurable given people do not have a bazillion notes, but still...)
(erm, typo, I mean O(N^2))
Damnit, I thought I'd got all of these. It seems that some number slipped through. Did you want to cook a patch for it?
Created attachment 61706 [details] [review] patch here is the patch, however it's not even compile tested (I don't have a full jhbuild set up at the moment) apart from the list loops I also moved the var declarations before the gconf functions to keep old compilers happy.
This patch looks fundamentally correct, did you want to test it and commit it?
In gnome-2-14, needs committing to HEAD.
I commited this to HEAD.