diff pidgin/plugins/history.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 7c8275692b3b
children 9bdd3ab8087f
line wrap: on
line diff
--- a/pidgin/plugins/history.c	Thu Nov 27 05:51:03 2008 +0000
+++ b/pidgin/plugins/history.c	Thu Nov 27 05:54:09 2008 +0000
@@ -47,10 +47,11 @@
 
 	convtype = purple_conversation_get_type(c);
 	gtkconv = PIDGIN_CONVERSATION(c);
-	if (gtkconv == NULL)
-		return;
+	g_return_if_fail(gtkconv != NULL);
 
-	if (convtype == PURPLE_CONV_TYPE_IM && g_list_length(gtkconv->convs) < 2)
+	/* An IM which is the first active conversation. */
+	g_return_if_fail(gtkconv->convs != NULL);
+	if (convtype == PURPLE_CONV_TYPE_IM && !gtkconv->convs->next)
 	{
 		GSList *buddies;
 		GSList *cur;