diff libpurple/savedstatuses.c @ 21563:1b174854bb80

merge of '30fcf2f336afb635b62a5c3ed3adb3e1fa1dd2d1' and 'bb60447c0a8c79afca320f4dc689096f4788e7fa'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 17 Nov 2007 01:55:21 +0000
parents 5136cd8f66f3
children f215729af7a7
line wrap: on
line diff
--- a/libpurple/savedstatuses.c	Wed Nov 14 03:15:32 2007 +0000
+++ b/libpurple/savedstatuses.c	Sat Nov 17 01:55:21 2007 +0000
@@ -761,10 +761,13 @@
 {
 	GList *popular = NULL;
 	GList *cur;
-	int i;
+	unsigned int i;
 	PurpleSavedStatus *next;
 
-	/* Copy 'how_many' elements to a new list */
+	/* Copy 'how_many' elements to a new list. If 'how_many' is 0, then copy all of 'em. */
+	if (how_many == 0)
+		how_many = (unsigned int) -1;
+
 	i = 0;
 	cur = saved_statuses;
 	while ((i < how_many) && (cur != NULL))
@@ -773,7 +776,7 @@
 		if ((!purple_savedstatus_is_transient(next)
 			|| purple_savedstatus_get_message(next) != NULL))
 		{
-			popular = g_list_prepend(popular, cur->data);
+			popular = g_list_prepend(popular, next);
 			i++;
 		}
 		cur = cur->next;