diff libpurple/protocols/yahoo/yahoochat.c @ 24552: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 b5210bb72273
children d8452c0bec7b 9bdd3ab8087f
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoochat.c	Thu Nov 27 05:51:03 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoochat.c	Thu Nov 27 05:54:09 2008 +0000
@@ -513,12 +513,12 @@
 
 	c = purple_find_chat(gc, YAHOO_CHAT_ID);
 
-	if (room && (!c || purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) && members &&
-	   ((g_list_length(members) > 1) ||
+	if (room && (!c || purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) &&
+	    members && (members->next ||
 	     !g_ascii_strcasecmp(members->data, purple_connection_get_display_name(gc)))) {
-		int i;
+		GList *l;
 		GList *flags = NULL;
-		for (i = 0; i < g_list_length(members); i++)
+		for (l = members; l; l = l->next)
 			flags = g_list_append(flags, GINT_TO_POINTER(PURPLE_CBFLAGS_NONE));
 		if (c && purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) {
 			/* this might be a hack, but oh well, it should nicely */