Mercurial > pidgin
comparison libpurple/protocols/simple/simple.c @ 29706: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 | 2cb6ea4420a0 |
children | 0fb628a28e5c |
comparison
equal
deleted
inserted
replaced
29705:1963a39c0ad1 | 29706:ae2b1f9bde75 |
---|---|
1963 | 1963 |
1964 static void simple_close(PurpleConnection *gc) | 1964 static void simple_close(PurpleConnection *gc) |
1965 { | 1965 { |
1966 struct simple_account_data *sip = gc->proto_data; | 1966 struct simple_account_data *sip = gc->proto_data; |
1967 | 1967 |
1968 if(sip) { | 1968 if (!sip) |
1969 /* unregister */ | 1969 return; |
1970 if (sip->registerstatus == SIMPLE_REGISTER_COMPLETE) | 1970 |
1971 { | 1971 /* unregister */ |
1972 g_hash_table_foreach(sip->buddies, | 1972 if (sip->registerstatus == SIMPLE_REGISTER_COMPLETE) |
1973 (GHFunc)simple_unsubscribe, | 1973 { |
1974 (gpointer)sip); | 1974 g_hash_table_foreach(sip->buddies, |
1975 | 1975 (GHFunc)simple_unsubscribe, |
1976 if(purple_account_get_bool(sip->account, | 1976 (gpointer)sip); |
1977 "dopublish", TRUE)) | 1977 |
1978 send_closed_publish(sip); | 1978 if (purple_account_get_bool(sip->account, "dopublish", TRUE)) |
1979 | 1979 send_closed_publish(sip); |
1980 do_register_exp(sip, 0); | 1980 |
1981 } | 1981 do_register_exp(sip, 0); |
1982 connection_free_all(sip); | 1982 } |
1983 | 1983 connection_free_all(sip); |
1984 if (sip->query_data != NULL) | 1984 |
1985 purple_dnsquery_destroy(sip->query_data); | 1985 if (sip->query_data != NULL) |
1986 | 1986 purple_dnsquery_destroy(sip->query_data); |
1987 if (sip->srv_query_data != NULL) | 1987 |
1988 purple_srv_cancel(sip->srv_query_data); | 1988 if (sip->srv_query_data != NULL) |
1989 | 1989 purple_srv_cancel(sip->srv_query_data); |
1990 if (sip->listen_data != NULL) | 1990 |
1991 purple_network_listen_cancel(sip->listen_data); | 1991 if (sip->listen_data != NULL) |
1992 | 1992 purple_network_listen_cancel(sip->listen_data); |
1993 g_free(sip->servername); | 1993 |
1994 g_free(sip->username); | 1994 g_free(sip->servername); |
1995 g_free(sip->password); | 1995 g_free(sip->username); |
1996 g_free(sip->registrar.nonce); | 1996 g_free(sip->password); |
1997 g_free(sip->registrar.opaque); | 1997 g_free(sip->registrar.nonce); |
1998 g_free(sip->registrar.target); | 1998 g_free(sip->registrar.opaque); |
1999 g_free(sip->registrar.realm); | 1999 g_free(sip->registrar.target); |
2000 g_free(sip->registrar.digest_session_key); | 2000 g_free(sip->registrar.realm); |
2001 g_free(sip->proxy.nonce); | 2001 g_free(sip->registrar.digest_session_key); |
2002 g_free(sip->proxy.opaque); | 2002 g_free(sip->proxy.nonce); |
2003 g_free(sip->proxy.target); | 2003 g_free(sip->proxy.opaque); |
2004 g_free(sip->proxy.realm); | 2004 g_free(sip->proxy.target); |
2005 g_free(sip->proxy.digest_session_key); | 2005 g_free(sip->proxy.realm); |
2006 g_free(sip->publish_etag); | 2006 g_free(sip->proxy.digest_session_key); |
2007 if(sip->txbuf) | 2007 g_free(sip->publish_etag); |
2008 purple_circ_buffer_destroy(sip->txbuf); | 2008 if (sip->txbuf) |
2009 g_free(sip->realhostname); | 2009 purple_circ_buffer_destroy(sip->txbuf); |
2010 if(sip->listenpa) purple_input_remove(sip->listenpa); | 2010 g_free(sip->realhostname); |
2011 if(sip->tx_handler) purple_input_remove(sip->tx_handler); | 2011 if (sip->listenpa) |
2012 if(sip->resendtimeout) purple_timeout_remove(sip->resendtimeout); | 2012 purple_input_remove(sip->listenpa); |
2013 if(sip->registertimeout) purple_timeout_remove(sip->registertimeout); | 2013 if (sip->tx_handler) |
2014 } | 2014 purple_input_remove(sip->tx_handler); |
2015 g_free(gc->proto_data); | 2015 if (sip->resendtimeout) |
2016 purple_timeout_remove(sip->resendtimeout); | |
2017 if (sip->registertimeout) | |
2018 purple_timeout_remove(sip->registertimeout); | |
2019 | |
2020 g_free(sip); | |
2016 gc->proto_data = NULL; | 2021 gc->proto_data = NULL; |
2017 } | 2022 } |
2018 | 2023 |
2019 static PurplePluginProtocolInfo prpl_info = | 2024 static PurplePluginProtocolInfo prpl_info = |
2020 { | 2025 { |