Mercurial > pidgin.yaz
diff pidgin/gtknotify.c @ 24497:f10aba5592c6
The other day while struct hiding, I noticed a for loop that was checking
g_list_length() as the loop conditional. I decided to check all our calls
to g_list_length() to see which ones I could clean up without too much work.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 27 Nov 2008 05:54:09 +0000 |
parents | 9b61b1088dfb |
children | 3d997c09b94e a063901a5499 |
line wrap: on
line diff
--- a/pidgin/gtknotify.c Thu Nov 27 05:51:03 2008 +0000 +++ b/pidgin/gtknotify.c Thu Nov 27 05:54:09 2008 +0000 @@ -730,7 +730,6 @@ GtkListStore *model = data->model; GtkTreeIter iter; GdkPixbuf *pixbuf; - guint col_num; GList *row, *column; guint n; @@ -738,9 +737,6 @@ pixbuf = pidgin_create_prpl_icon(purple_connection_get_account(gc), 0.5); - /* +1 is for the automagically created Status column. */ - col_num = g_list_length(results->columns) + 1; - for (row = results->rows; row != NULL; row = row->next) { gtk_list_store_append(model, &iter); @@ -776,6 +772,7 @@ guint col_num; GList *columniter; guint i; + GList *l; GtkWidget *vbox; GtkWidget *label; @@ -869,8 +866,8 @@ i++; } - for (i = 0; i < g_list_length(results->buttons); i++) { - PurpleNotifySearchButton *b = g_list_nth_data(results->buttons, i); + for (l = results->buttons; l; l = l->next) { + PurpleNotifySearchButton *b = l->data; GtkWidget *button = NULL; switch (b->type) { case PURPLE_NOTIFY_BUTTON_LABELED: