Mercurial > pidgin.yaz
changeset 30117:ae2b1f9bde75
Exit early if sip is null, instead of putting the whole body of this
function in an if block
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 12 Apr 2010 03:42:03 +0000 |
parents | 1963a39c0ad1 |
children | 4d0ccbc905aa fd2d15e57763 |
files | libpurple/protocols/simple/simple.c |
diffstat | 1 files changed, 47 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/simple/simple.c Mon Apr 12 00:24:04 2010 +0000 +++ b/libpurple/protocols/simple/simple.c Mon Apr 12 03:42:03 2010 +0000 @@ -1965,54 +1965,59 @@ { 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; + + /* unregister */ + if (sip->registerstatus == SIMPLE_REGISTER_COMPLETE) + { + g_hash_table_foreach(sip->buddies, + (GHFunc)simple_unsubscribe, + (gpointer)sip); + + if (purple_account_get_bool(sip->account, "dopublish", TRUE)) + send_closed_publish(sip); - if(purple_account_get_bool(sip->account, - "dopublish", TRUE)) - send_closed_publish(sip); + do_register_exp(sip, 0); + } + connection_free_all(sip); - do_register_exp(sip, 0); - } - connection_free_all(sip); + if (sip->query_data != NULL) + purple_dnsquery_destroy(sip->query_data); - if (sip->query_data != NULL) - purple_dnsquery_destroy(sip->query_data); + if (sip->srv_query_data != NULL) + purple_srv_cancel(sip->srv_query_data); - if (sip->srv_query_data != NULL) - purple_srv_cancel(sip->srv_query_data); + if (sip->listen_data != NULL) + purple_network_listen_cancel(sip->listen_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->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); + g_free(sip); gc->proto_data = NULL; }