[empathy] Don't reinvent g_slist_foreach



commit 82ee2cfb806cd91b6a58a1e3d4cceabbe736ee5a
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Sat Feb 13 16:44:39 2010 +0000

    Don't reinvent g_slist_foreach

 libempathy-gtk/empathy-chat.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 5702adb..4594d4d 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -2954,9 +2954,7 @@ empathy_chat_messages_read (EmpathyChat *self)
 	/* ...else, we can't do any acknowledging because the channel (or
 	 * indeed connection) has gone away. */
 
-	while (priv->pending_messages != NULL) {
-		g_object_unref (priv->pending_messages->data);
-		priv->pending_messages = g_slist_delete_link (
-			priv->pending_messages, priv->pending_messages);
-	}
+	g_slist_foreach (priv->pending_messages, (GFunc) g_object_unref, NULL);
+	g_slist_free (priv->pending_messages);
+	priv->pending_messages = NULL;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]