changeset 30753:2244a84407a4

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.
author Paul Aurich <paul@darkrain42.org>
date Sun, 01 Aug 2010 03:23:24 +0000
parents 00851eae12c7
children bb1d593f185c 4a88d29b8bae 06d8de5dd53c
files libpurple/protocols/jabber/jabber.c
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sat Jul 31 23:43:39 2010 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sun Aug 01 03:23:24 2010 +0000
@@ -567,8 +567,7 @@
 	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 @@
 	/* 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 @@
 	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 @@
 	/* 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 @@
 	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;