pidgin: 15918ce5: jabber: g_return-ify some PURPLE_CONNECT...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sat Jul 31 23:26:34 EDT 2010


----------------------------------------------------------------------
Revision: 15918ce5d9936f807bc9de90658ac830d3b343f9
Parent:   57e32abb12a78079affb4d057471b9881ef93f65
Author:   darkrain42 at pidgin.im
Date:     07/31/10 23:23:24
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/15918ce5d9936f807bc9de90658ac830d3b343f9

Changelog: 

jabber: g_return-ify some PURPLE_CONNECTION_IS_VALID checks

I'm pretty convinced these can't happen anymore, as jabber_close
disposes of everything, but I don't want to (re)introduce crashes.

Changes against parent 57e32abb12a78079affb4d057471b9881ef93f65

  patched  libpurple/protocols/jabber/jabber.c

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	c602a7a2808c1f0e3e519f22de419b7a79f71253
+++ libpurple/protocols/jabber/jabber.c	25260820be2cafec7a49b89f5a489bcf50c912f2
@@ -567,8 +567,7 @@ void jabber_send_signal_cb(PurpleConnect
 	if (NULL == packet)
 		return;
 
-	if (!PURPLE_CONNECTION_IS_VALID(pc))
-		return;
+	g_return_if_fail(PURPLE_CONNECTION_IS_VALID(pc));
 
 	js = purple_connection_get_protocol_data(pc);
 
@@ -625,7 +624,7 @@ jabber_recv_cb_ssl(gpointer data, Purple
 	/* TODO: It should be possible to make this check unnecessary */
 	if(!PURPLE_CONNECTION_IS_VALID(gc)) {
 		purple_ssl_close(gsc);
-		return;
+		g_return_if_reached();
 	}
 
 	while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) {
@@ -660,8 +659,7 @@ jabber_recv_cb(gpointer data, gint sourc
 	int len;
 	static char buf[4096];
 
-	if(!PURPLE_CONNECTION_IS_VALID(gc))
-		return;
+	g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
 
 	if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) {
 		gc->last_received = time(NULL);
@@ -721,7 +719,7 @@ jabber_login_callback_ssl(gpointer data,
 	/* TODO: It should be possible to make this check unnecessary */
 	if(!PURPLE_CONNECTION_IS_VALID(gc)) {
 		purple_ssl_close(gsc);
-		return;
+		g_return_if_reached();
 	}
 
 	js = gc->proto_data;
@@ -816,8 +814,7 @@ jabber_ssl_connect_failure(PurpleSslConn
 	JabberStream *js;
 
 	/* If the connection is already disconnected, we don't need to do anything else */
-	if(!PURPLE_CONNECTION_IS_VALID(gc))
-		return;
+	g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
 
 	js = gc->proto_data;
 	js->gsc = NULL;


More information about the Commits mailing list