Mercurial > pidgin
changeset 31036:05e05d96ba75
Use the unref functions everywhere, instead of destroy. I also removed
some unnecessary checks in the destroy functions, since it's already
OK from the unref.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Wed, 15 Dec 2010 23:10:13 +0000 |
parents | fa9b2cf68b9b |
children | 0d5e038911a7 |
files | libpurple/protocols/msn/cmdproc.c libpurple/protocols/msn/command.c libpurple/protocols/msn/command.h libpurple/protocols/msn/directconn.c libpurple/protocols/msn/msg.c libpurple/protocols/msn/slplink.c libpurple/protocols/msn/slpmsg.c libpurple/protocols/msn/slpmsg_part.c libpurple/protocols/msn/slpmsg_part.h libpurple/protocols/msn/user.c |
diffstat | 10 files changed, 9 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/cmdproc.c Wed Dec 15 22:21:07 2010 +0000 +++ b/libpurple/protocols/msn/cmdproc.c Wed Dec 15 23:10:13 2010 +0000 @@ -58,7 +58,7 @@ msn_history_destroy(cmdproc->history); if (cmdproc->last_cmd != NULL) - msn_command_destroy(cmdproc->last_cmd); + msn_command_unref(cmdproc->last_cmd); g_hash_table_destroy(cmdproc->multiparts); @@ -329,7 +329,7 @@ show_debug_cmd(cmdproc, TRUE, command); if (cmdproc->last_cmd != NULL) - msn_command_destroy(cmdproc->last_cmd); + msn_command_unref(cmdproc->last_cmd); cmdproc->last_cmd = msn_command_from_string(command);
--- a/libpurple/protocols/msn/command.c Wed Dec 15 22:21:07 2010 +0000 +++ b/libpurple/protocols/msn/command.c Wed Dec 15 23:10:13 2010 +0000 @@ -79,20 +79,10 @@ return cmd; } -void +static void msn_command_destroy(MsnCommand *cmd) { - g_return_if_fail(cmd != NULL); - - if (cmd->ref_count > 0) - { - msn_command_unref(cmd); - return; - } - - if (cmd->payload != NULL) - g_free(cmd->payload); - + g_free(cmd->payload); g_free(cmd->command); g_strfreev(cmd->params); g_free(cmd);
--- a/libpurple/protocols/msn/command.h Wed Dec 15 22:21:07 2010 +0000 +++ b/libpurple/protocols/msn/command.h Wed Dec 15 23:10:13 2010 +0000 @@ -64,14 +64,6 @@ MsnCommand *msn_command_from_string(const char *string); /** - * Destroy a MsnCommand object if its ref count is zero, otherwise - * just unref it. - * - * @param cmd The MsnCommand to be destroyed. - */ -void msn_command_destroy(MsnCommand *cmd); - -/** * Increment the ref count. * * @param cmd The MsnCommand to be ref.
--- a/libpurple/protocols/msn/directconn.c Wed Dec 15 22:21:07 2010 +0000 +++ b/libpurple/protocols/msn/directconn.c Wed Dec 15 23:10:13 2010 +0000 @@ -602,7 +602,7 @@ if (dc->header.length) { part = msn_slpmsgpart_new_from_data(dc->in_buffer + 4, dc->header.length); msn_slplink_process_msg(dc->slplink, part); - msn_slpmsgpart_destroy(part); + msn_slpmsgpart_unref(part); } /*
--- a/libpurple/protocols/msn/msg.c Wed Dec 15 22:21:07 2010 +0000 +++ b/libpurple/protocols/msn/msg.c Wed Dec 15 23:10:13 2010 +0000 @@ -70,7 +70,8 @@ g_hash_table_destroy(msg->header_table); g_list_free(msg->header_list); - msn_slpmsgpart_destroy(msg->part); + if (msg->part) + msn_slpmsgpart_unref(msg->part); g_free(msg); }
--- a/libpurple/protocols/msn/slplink.c Wed Dec 15 22:21:07 2010 +0000 +++ b/libpurple/protocols/msn/slplink.c Wed Dec 15 23:10:13 2010 +0000 @@ -96,18 +96,11 @@ if (purple_debug_is_verbose()) purple_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink); - g_return_if_fail(slplink != NULL); - if (slplink->swboard != NULL) { slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); slplink->swboard = NULL; } - if (slplink->refs > 1) { - slplink->refs--; - return; - } - session = slplink->session; if (slplink->dc != NULL) {
--- a/libpurple/protocols/msn/slpmsg.c Wed Dec 15 22:21:07 2010 +0000 +++ b/libpurple/protocols/msn/slpmsg.c Wed Dec 15 23:10:13 2010 +0000 @@ -85,7 +85,7 @@ part->ack_cb = NULL; part->nak_cb = NULL; part->ack_data = NULL; - msn_slpmsgpart_destroy(part); + msn_slpmsgpart_unref(part); } slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg);
--- a/libpurple/protocols/msn/slpmsg_part.c Wed Dec 15 22:21:07 2010 +0000 +++ b/libpurple/protocols/msn/slpmsg_part.c Wed Dec 15 23:10:13 2010 +0000 @@ -81,17 +81,8 @@ return part; } -void msn_slpmsgpart_destroy(MsnSlpMessagePart *part) +static void msn_slpmsgpart_destroy(MsnSlpMessagePart *part) { - if (!part) - return; - - if (part->ref_count > 0) { - msn_slpmsgpart_unref(part); - - return; - } - g_free(part->header); g_free(part->footer);
--- a/libpurple/protocols/msn/slpmsg_part.h Wed Dec 15 22:21:07 2010 +0000 +++ b/libpurple/protocols/msn/slpmsg_part.h Wed Dec 15 23:10:13 2010 +0000 @@ -49,8 +49,6 @@ MsnSlpMessagePart *msn_slpmsgpart_new_from_data(const char *data, size_t data_len); -void msn_slpmsgpart_destroy(MsnSlpMessagePart *part); - MsnSlpMessagePart *msn_slpmsgpart_ref(MsnSlpMessagePart *part); void msn_slpmsgpart_unref(MsnSlpMessagePart *part);
--- a/libpurple/protocols/msn/user.c Wed Dec 15 22:21:07 2010 +0000 +++ b/libpurple/protocols/msn/user.c Wed Dec 15 23:10:13 2010 +0000 @@ -57,13 +57,6 @@ static void msn_user_destroy(MsnUser *user) { - g_return_if_fail(user != NULL); - - if (user->refcount > 1) { - msn_user_unref(user); - return; - } - while (user->endpoints != NULL) { free_user_endpoint(user->endpoints->data); user->endpoints = g_slist_delete_link(user->endpoints, user->endpoints);