Mercurial > pidgin
comparison libpurple/protocols/msn/msg.c @ 30953:5eb2ea662d8c
Nothing uses this return value, so stop returning it. I think it's weird
for an unref function to return a pointer to the object you unreffed.
I see how there could be an argument for such a thing... but it seems like
it would be better to write code that doesn't require knowing whether the
object you unreffed was destroyed.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 22 Nov 2010 07:43:56 +0000 |
parents | b4285ea42b6e |
children | 61db10475bed |
comparison
equal
deleted
inserted
replaced
30952:b4285ea42b6e | 30953:5eb2ea662d8c |
---|---|
86 purple_debug_info("msn", "message ref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); | 86 purple_debug_info("msn", "message ref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); |
87 | 87 |
88 return msg; | 88 return msg; |
89 } | 89 } |
90 | 90 |
91 MsnMessage * | 91 void |
92 msn_message_unref(MsnMessage *msg) | 92 msn_message_unref(MsnMessage *msg) |
93 { | 93 { |
94 g_return_val_if_fail(msg != NULL, NULL); | 94 g_return_if_fail(msg != NULL); |
95 g_return_val_if_fail(msg->ref_count > 0, NULL); | 95 g_return_if_fail(msg->ref_count > 0); |
96 | 96 |
97 msg->ref_count--; | 97 msg->ref_count--; |
98 | 98 |
99 if (purple_debug_is_verbose()) | 99 if (purple_debug_is_verbose()) |
100 purple_debug_info("msn", "message unref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); | 100 purple_debug_info("msn", "message unref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); |
101 | 101 |
102 if (msg->ref_count == 0) | 102 if (msg->ref_count == 0) |
103 { | |
104 msn_message_destroy(msg); | 103 msn_message_destroy(msg); |
105 | |
106 return NULL; | |
107 } | |
108 | |
109 return msg; | |
110 } | 104 } |
111 | 105 |
112 MsnMessage * | 106 MsnMessage * |
113 msn_message_new_plain(const char *message) | 107 msn_message_new_plain(const char *message) |
114 { | 108 { |