pidgin: 9995578b: Optimize just a teensy-tiny bit.

qulogic at pidgin.im qulogic at pidgin.im
Mon Aug 23 01:32:00 EDT 2010


----------------------------------------------------------------------
Revision: 9995578be971846ae7becbf8ef51b35429ccb913
Parent:   c8130906dcdd030bff2ffc1beb28e32508170f5b
Author:   qulogic at pidgin.im
Date:     08/22/10 02:40:30
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/9995578be971846ae7becbf8ef51b35429ccb913

Changelog: 

Optimize just a teensy-tiny bit.

Changes against parent c8130906dcdd030bff2ffc1beb28e32508170f5b

  patched  libpurple/stun.c

-------------- next part --------------
============================================================
--- libpurple/stun.c	c2665555c19747a8c365d06cbf2e5c661b5f5013
+++ libpurple/stun.c	a8e35764faf2fe8424ba8de9f5c7963d66d4ca6b
@@ -105,11 +105,11 @@ static void do_callbacks(void) {
 }
 
 static void do_callbacks(void) {
-	while(callbacks) {
+	while (callbacks) {
 		StunCallback cb = callbacks->data;
-		if(cb)
+		if (cb)
 			cb(&nattype);
-		callbacks = g_slist_remove(callbacks, cb);
+		callbacks = g_slist_delete_link(callbacks, callbacks);
 	}
 }
 
@@ -280,7 +280,6 @@ static void hbn_listen_cb(int fd, gpoint
 	GSList *hosts = data;
 	struct stun_conn *sc;
 	static struct stun_header hdr_data;
-	int ret;
 
 	if(fd < 0) {
 		nattype.status = PURPLE_STUN_STATUS_UNKNOWN;
@@ -298,15 +297,14 @@ static void hbn_listen_cb(int fd, gpoint
 
 	sc->incb = purple_input_add(fd, PURPLE_INPUT_READ, reply_cb, sc);
 
-	ret = GPOINTER_TO_INT(hosts->data);
-	hosts = g_slist_remove(hosts, hosts->data);
+	hosts = g_slist_delete_link(hosts, hosts);
 	memcpy(&(sc->addr), hosts->data, sizeof(struct sockaddr_in));
 	g_free(hosts->data);
-	hosts = g_slist_remove(hosts, hosts->data);
-	while(hosts) {
-		hosts = g_slist_remove(hosts, hosts->data);
+	hosts = g_slist_delete_link(hosts, hosts);
+	while (hosts) {
+		hosts = g_slist_delete_link(hosts, hosts);
 		g_free(hosts->data);
-		hosts = g_slist_remove(hosts, hosts->data);
+		hosts = g_slist_delete_link(hosts, hosts);
 	}
 
 	hdr_data.type = htons(MSGTYPE_BINDINGREQUEST);
@@ -341,10 +339,10 @@ static void hbn_cb(GSList *hosts, gpoint
 	}
 
 	if (!purple_network_listen_range(12108, 12208, SOCK_DGRAM, hbn_listen_cb, hosts)) {
-		while(hosts) {
-			hosts = g_slist_remove(hosts, hosts->data);
+		while (hosts) {
+			hosts = g_slist_delete_link(hosts, hosts);
 			g_free(hosts->data);
-			hosts = g_slist_remove(hosts, hosts->data);
+			hosts = g_slist_delete_link(hosts, hosts);
 		}
 
 		nattype.status = PURPLE_STUN_STATUS_UNKNOWN;


More information about the Commits mailing list