pidgin: eb19edf3: Reuse cleanup function.

datallah at pidgin.im datallah at pidgin.im
Sun May 11 22:36:06 EDT 2008


-----------------------------------------------------------------
Revision: eb19edf341bf08bbc321f03bac6dba344e2a7d1e
Ancestor: 5f944d9a35a6f30cfb32691afa6bd7a2b6ed7268
Author: datallah at pidgin.im
Date: 2008-05-12T02:18:11
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/eb19edf341bf08bbc321f03bac6dba344e2a7d1e

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

ChangeLog: 

Reuse cleanup function.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/si.c	4a6b4229f8f4e2f7407f445e96d391470ca07e79
+++ libpurple/protocols/jabber/si.c	a0b252c271e733204f6550f65651c52a31d25a6d
@@ -84,7 +84,22 @@ jabber_si_xfer_find(JabberStream *js, co
 	return NULL;
 }
 
+static void
+jabber_si_free_streamhost(gpointer data, gpointer user_data)
+{
+	JabberBytestreamsStreamhost *sh = data;
 
+	if(!data)
+		return;
+
+	g_free(sh->jid);
+	g_free(sh->host);
+	g_free(sh->zeroconf);
+	g_free(sh);
+}
+
+
+
 static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer);
 
 static void
@@ -110,10 +125,7 @@ jabber_si_bytestreams_connect_cb(gpointe
 				streamhost->jid, streamhost->host,
 				error_message ? error_message : "(null)");
 		jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost);
-		g_free(streamhost->jid);
-		g_free(streamhost->host);
-		g_free(streamhost->zeroconf);
-		g_free(streamhost);
+		jabber_si_free_streamhost(streamhost, NULL);
 		jabber_si_bytestreams_attempt_connect(xfer);
 		return;
 	}
@@ -245,10 +257,7 @@ static void jabber_si_bytestreams_attemp
 	if (jsx->connect_data == NULL)
 	{
 		jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost);
-		g_free(streamhost->jid);
-		g_free(streamhost->host);
-		g_free(streamhost->zeroconf);
-		g_free(streamhost);
+		jabber_si_free_streamhost(streamhost, NULL);
 		jabber_si_bytestreams_attempt_connect(xfer);
 	}
 }
@@ -299,6 +308,7 @@ void jabber_bytestreams_parse(JabberStre
 			sh->host = g_strdup(host);
 			sh->port = portnum;
 			sh->zeroconf = g_strdup(zeroconf);
+			/* If there were a lot of these, it'd be worthwhile to prepend and reverse. */
 			jsx->streamhosts = g_list_append(jsx->streamhosts, sh);
 		}
 	}
@@ -593,22 +603,7 @@ jabber_si_compare_jid(gconstpointer a, g
 	return strcmp(sh->jid, (char *)b);
 }
 
-
 static void
-jabber_si_free_streamhost(gpointer data, gpointer user_data)
-{
-	JabberBytestreamsStreamhost *sh = data;
-
-	if(!data)
-		return;
-
-	g_free(sh->jid);
-	g_free(sh->host);
-	g_free(sh->zeroconf);
-	g_free(sh);
-}
-
-static void
 jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source,
 		PurpleInputCondition cond)
 {
@@ -826,7 +821,7 @@ jabber_si_xfer_bytestreams_listen_cb(int
 		sh2 = g_new0(JabberBytestreamsStreamhost, 1);
 		sh2->jid = g_strdup(sh->jid);
 		sh2->host = g_strdup(sh->host);
-		sh2->zeroconf = g_strdup(sh->zeroconf);
+		/*sh2->zeroconf = g_strdup(sh->zeroconf);*/
 		sh2->port = sh->port;
 
 		jsx->streamhosts = g_list_prepend(jsx->streamhosts, sh2);


More information about the Commits mailing list