diff libpurple/protocols/oscar/util.c @ 30380:2d4dd38c5db5

Two small fixes Mark suggested: 1. Removed unused parameter in get_buddy_list_type(). 2. Changed oscar_format_buddies() to use GString.
author ivan.komarov@soc.pidgin.im
date Mon, 19 Jul 2010 22:05:38 +0000
parents 4e804413b12b
children 88689cda97d8
line wrap: on
line diff
--- a/libpurple/protocols/oscar/util.c	Sun Jul 04 01:13:11 2010 +0000
+++ b/libpurple/protocols/oscar/util.c	Mon Jul 19 22:05:38 2010 +0000
@@ -392,22 +392,20 @@
 oscar_format_buddies(GSList *buddies, const gchar *no_buddies_message)
 {
 	GSList *cur;
-	gchar *result, *tmp;
+	GString *result;
 	if (!buddies) {
 		return g_strdup_printf("<i>%s</i>", no_buddies_message);
 	}
-	result = g_strdup("");
+	result = g_string_new("");
 	for (cur = buddies; cur != NULL; cur = cur->next) {
 		PurpleBuddy *buddy = cur->data;
 		const gchar *bname = purple_buddy_get_name(buddy);
 		const gchar *alias = purple_buddy_get_alias_only(buddy);
+		g_string_append(result, bname);
 		if (alias) {
-			tmp = g_strdup_printf("%s%s (%s)<br>", result, bname, alias);
-		} else {
-			tmp = g_strdup_printf("%s%s<br>", result, bname);
+			g_string_append_printf(result, " (%s)", alias);
 		}
-		g_free(result);
-		result = tmp;
+		g_string_append(result, "<br>");
 	}
-	return result;
+	return g_string_free(result, FALSE);
 }
\ No newline at end of file