cpw.darkrain42.roster: 976d8748: Operate on the passed-in GSList.

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Jun 21 18:20:36 EDT 2009


-----------------------------------------------------------------
Revision: 976d874853ac9745edb77d3cf107b92ebc037c10
Ancestor: 0a50fd4c5f86432fdee427858cd39dcfffb8c466
Author: darkrain42 at pidgin.im
Date: 2009-06-10T04:42:11
Branch: im.pidgin.cpw.darkrain42.roster
URL: http://d.pidgin.im/viewmtn/revision/info/976d874853ac9745edb77d3cf107b92ebc037c10

Modified files:
        libpurple/protocols/jabber/roster.c

ChangeLog: 

Operate on the passed-in GSList.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/roster.c	63120e244700f7b4c8a393238047e6816da91add
+++ libpurple/protocols/jabber/roster.c	ab0c15f7665180d07c6a9bbac5abc28db3b0f5f8
@@ -265,12 +265,13 @@ void jabber_roster_parse(JabberStream *j
 		jabber_stream_set_state(js, JABBER_STREAM_CONNECTED);
 }
 
+/* jabber_roster_update frees the GSList* passed in */
 static void jabber_roster_update(JabberStream *js, const char *name,
-		GSList *grps)
+		GSList *groups)
 {
 	PurpleBuddy *b;
 	PurpleGroup *g;
-	GSList *groups = NULL, *l;
+	GSList *l;
 	JabberIq *iq;
 	xmlnode *query, *item, *group;
 	const char *balias;
@@ -281,12 +282,11 @@ static void jabber_roster_update(JabberS
 	if(!(b = purple_find_buddy(js->gc->account, name)))
 		return;
 
-	if(grps) {
+	if (groups) {
 		char *tmp = roster_groups_join(groups);
-		groups = grps;
 
-		purple_debug_info("jabber", "jabber_roster_update(%s): [Source: grps]: groups: %s\n",
-		                  name, tmp);
+		purple_debug_info("jabber", "jabber_roster_update(%s): [Source: "
+		                  "groups]: groups: %s\n", name, tmp);
 		g_free(tmp);
 	} else {
 		GSList *buddies = purple_find_buddies(js->gc->account, name);
@@ -322,8 +322,7 @@ static void jabber_roster_update(JabberS
 		xmlnode_insert_data(group, l->data, -1);
 	}
 
-	if(!grps)
-		g_slist_free(groups);
+	g_slist_free(groups);
 
 	if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) {
 		jabber_google_roster_outgoing(js, query, item);
@@ -414,7 +413,6 @@ void jabber_roster_group_change(PurpleCo
 	                  name, old_group, new_group);
 
 	jabber_roster_update(gc->proto_data, name, groups);
-	g_slist_free(groups);
 }
 
 void jabber_roster_group_rename(PurpleConnection *gc, const char *old_name,
@@ -450,7 +448,6 @@ void jabber_roster_remove_buddy(PurpleCo
 		                  purple_buddy_get_name(buddy), purple_group_get_name(group));
 
 		jabber_roster_update(gc->proto_data, name, groups);
-		g_slist_free(groups);
 	} else {
 		JabberIq *iq = jabber_iq_new_query(gc->proto_data, JABBER_IQ_SET,
 				"jabber:iq:roster");


More information about the Commits mailing list