pidgin: 40dca581: Exit early if sip is null, instead of pu...

markdoliner at pidgin.im markdoliner at pidgin.im
Sun Apr 11 23:45:46 EDT 2010


-----------------------------------------------------------------
Revision: 40dca581f0e3d66f108176cb100ff915cfcf28a2
Ancestor: b9d65f587a31a1afaef0d73a97c0c0c758868bc4
Author: markdoliner at pidgin.im
Date: 2010-04-12T03:42:03
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/40dca581f0e3d66f108176cb100ff915cfcf28a2

Modified files:
        libpurple/protocols/simple/simple.c

ChangeLog: 

Exit early if sip is null, instead of putting the whole body of this
function in an if block

-------------- next part --------------
============================================================
--- libpurple/protocols/simple/simple.c	e1b1c72b45abee23539d6b490771114dfffb238a
+++ libpurple/protocols/simple/simple.c	832cd403db6f793561d70a4ea6d8beae6331ef73
@@ -1965,54 +1965,59 @@ static void simple_close(PurpleConnectio
 {
 	struct simple_account_data *sip = gc->proto_data;
 
-	if(sip) {
-		/* unregister */
-		if (sip->registerstatus == SIMPLE_REGISTER_COMPLETE)
-		{
-			g_hash_table_foreach(sip->buddies,
-				(GHFunc)simple_unsubscribe,
-				(gpointer)sip);
+	if (!sip)
+		return;
 
-			if(purple_account_get_bool(sip->account,
-						   "dopublish", TRUE))
-				send_closed_publish(sip);
+	/* unregister */
+	if (sip->registerstatus == SIMPLE_REGISTER_COMPLETE)
+	{
+		g_hash_table_foreach(sip->buddies,
+			(GHFunc)simple_unsubscribe,
+			(gpointer)sip);
 
-			do_register_exp(sip, 0);
-		}
-		connection_free_all(sip);
+		if (purple_account_get_bool(sip->account, "dopublish", TRUE))
+			send_closed_publish(sip);
 
-		if (sip->query_data != NULL)
-			purple_dnsquery_destroy(sip->query_data);
+		do_register_exp(sip, 0);
+	}
+	connection_free_all(sip);
 
-		if (sip->srv_query_data != NULL)
-			purple_srv_cancel(sip->srv_query_data);
+	if (sip->query_data != NULL)
+		purple_dnsquery_destroy(sip->query_data);
 
-		if (sip->listen_data != NULL)
-			purple_network_listen_cancel(sip->listen_data);
+	if (sip->srv_query_data != NULL)
+		purple_srv_cancel(sip->srv_query_data);
 
-		g_free(sip->servername);
-		g_free(sip->username);
-		g_free(sip->password);
-		g_free(sip->registrar.nonce);
-		g_free(sip->registrar.opaque);
-		g_free(sip->registrar.target);
-		g_free(sip->registrar.realm);
-		g_free(sip->registrar.digest_session_key);
-		g_free(sip->proxy.nonce);
-		g_free(sip->proxy.opaque);
-		g_free(sip->proxy.target);
-		g_free(sip->proxy.realm);
-		g_free(sip->proxy.digest_session_key);
-		g_free(sip->publish_etag);
-		if(sip->txbuf)
-			purple_circ_buffer_destroy(sip->txbuf);
-		g_free(sip->realhostname);
-		if(sip->listenpa) purple_input_remove(sip->listenpa);
-		if(sip->tx_handler) purple_input_remove(sip->tx_handler);
-		if(sip->resendtimeout) purple_timeout_remove(sip->resendtimeout);
-		if(sip->registertimeout) purple_timeout_remove(sip->registertimeout);
-	}
-	g_free(gc->proto_data);
+	if (sip->listen_data != NULL)
+		purple_network_listen_cancel(sip->listen_data);
+
+	g_free(sip->servername);
+	g_free(sip->username);
+	g_free(sip->password);
+	g_free(sip->registrar.nonce);
+	g_free(sip->registrar.opaque);
+	g_free(sip->registrar.target);
+	g_free(sip->registrar.realm);
+	g_free(sip->registrar.digest_session_key);
+	g_free(sip->proxy.nonce);
+	g_free(sip->proxy.opaque);
+	g_free(sip->proxy.target);
+	g_free(sip->proxy.realm);
+	g_free(sip->proxy.digest_session_key);
+	g_free(sip->publish_etag);
+	if (sip->txbuf)
+		purple_circ_buffer_destroy(sip->txbuf);
+	g_free(sip->realhostname);
+	if (sip->listenpa)
+		purple_input_remove(sip->listenpa);
+	if (sip->tx_handler)
+		purple_input_remove(sip->tx_handler);
+	if (sip->resendtimeout)
+		purple_timeout_remove(sip->resendtimeout);
+	if (sip->registertimeout)
+		purple_timeout_remove(sip->registertimeout);
+
+	g_free(sip);
 	gc->proto_data = NULL;
 }
 


More information about the Commits mailing list