changeset 31478:61db10475bed

As Mark did before, we probably don't need a return value from these unref functions. Also, make the ref counts unsigned.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 15 Dec 2010 04:17:59 +0000
parents 84c5575d08de
children 2f2c45abb3af
files libpurple/protocols/msn/command.c libpurple/protocols/msn/command.h libpurple/protocols/msn/msg.c libpurple/protocols/msn/msg.h libpurple/protocols/msn/slplink.h libpurple/protocols/msn/slpmsg_part.c libpurple/protocols/msn/slpmsg_part.h
diffstat 7 files changed, 22 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/command.c	Wed Dec 15 00:00:12 2010 +0000
+++ b/libpurple/protocols/msn/command.c	Wed Dec 15 04:17:59 2010 +0000
@@ -107,19 +107,17 @@
 	return cmd;
 }
 
-MsnCommand *
+void
 msn_command_unref(MsnCommand *cmd)
 {
-	g_return_val_if_fail(cmd != NULL, NULL);
-	g_return_val_if_fail(cmd->ref_count > 0, NULL);
+	g_return_if_fail(cmd != NULL);
+	g_return_if_fail(cmd->ref_count > 0);
 
 	cmd->ref_count--;
 
 	if (cmd->ref_count == 0)
 	{
 		msn_command_destroy(cmd);
-		return NULL;
 	}
+}
 
-	return cmd;
-}
--- a/libpurple/protocols/msn/command.h	Wed Dec 15 00:00:12 2010 +0000
+++ b/libpurple/protocols/msn/command.h	Wed Dec 15 04:17:59 2010 +0000
@@ -43,7 +43,7 @@
 	char **params;
 	int param_count;
 
-	int ref_count;
+	guint ref_count;
 
 	MsnTransaction *trans;
 
@@ -85,8 +85,8 @@
  *
  * @param cmd	The MsnCommand to be unref.
  *
- * @return 		The ref command.
  */
-MsnCommand *msn_command_unref(MsnCommand *cmd);
+void msn_command_unref(MsnCommand *cmd);
 
 #endif /* MSN_COMMAND_H */
+
--- a/libpurple/protocols/msn/msg.c	Wed Dec 15 00:00:12 2010 +0000
+++ b/libpurple/protocols/msn/msg.c	Wed Dec 15 04:17:59 2010 +0000
@@ -83,7 +83,7 @@
 	msg->ref_count++;
 
 	if (purple_debug_is_verbose())
-		purple_debug_info("msn", "message ref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count);
+		purple_debug_info("msn", "message ref (%p)[%u]\n", msg, msg->ref_count);
 
 	return msg;
 }
@@ -97,7 +97,7 @@
 	msg->ref_count--;
 
 	if (purple_debug_is_verbose())
-		purple_debug_info("msn", "message unref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count);
+		purple_debug_info("msn", "message unref (%p)[%u]\n", msg, msg->ref_count);
 
 	if (msg->ref_count == 0)
 		msn_message_destroy(msg);
--- a/libpurple/protocols/msn/msg.h	Wed Dec 15 00:00:12 2010 +0000
+++ b/libpurple/protocols/msn/msg.h	Wed Dec 15 04:17:59 2010 +0000
@@ -74,7 +74,7 @@
  */
 struct _MsnMessage
 {
-	size_t ref_count;           /**< The reference count.       */
+	guint ref_count;        /**< The reference count.       */
 
 	MsnMsgType type;
 
@@ -89,8 +89,8 @@
 	char *charset;
 	char *body;
 	gsize body_len;
-	guint total_chunks;   /**< How many chunks in this multi-part message */
-	guint received_chunks; /**< How many chunks we've received so far */
+	guint total_chunks;     /**< How many chunks in this multi-part message */
+	guint received_chunks;  /**< How many chunks we've received so far */
 
 	GHashTable *header_table;
 	GList *header_list;
--- a/libpurple/protocols/msn/slplink.h	Wed Dec 15 00:00:12 2010 +0000
+++ b/libpurple/protocols/msn/slplink.h	Wed Dec 15 04:17:59 2010 +0000
@@ -42,7 +42,7 @@
 	MsnSwitchBoard *swboard;
 	MsnDirectConn *dc;
 
-	int refs;
+	guint refs;
 
 	char *remote_user;
 
--- a/libpurple/protocols/msn/slpmsg_part.c	Wed Dec 15 00:00:12 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg_part.c	Wed Dec 15 04:17:59 2010 +0000
@@ -102,31 +102,27 @@
 MsnSlpMessagePart *msn_slpmsgpart_ref(MsnSlpMessagePart *part)
 {
 	g_return_val_if_fail(part != NULL, NULL);
-	part->ref_count ++;
+	part->ref_count++;
 
 	if (purple_debug_is_verbose())
-		purple_debug_info("msn", "part ref (%p)[%d]\n", part, part->ref_count);
+		purple_debug_info("msn", "part ref (%p)[%u]\n", part, part->ref_count);
 
 	return part;
 }
 
-MsnSlpMessagePart *msn_slpmsgpart_unref(MsnSlpMessagePart *part)
+void msn_slpmsgpart_unref(MsnSlpMessagePart *part)
 {
-	g_return_val_if_fail(part != NULL, NULL);
-	g_return_val_if_fail(part->ref_count > 0, NULL);
+	g_return_if_fail(part != NULL);
+	g_return_if_fail(part->ref_count > 0);
 
 	part->ref_count--;
 
 	if (purple_debug_is_verbose())
-		purple_debug_info("msn", "part unref (%p)[%d]\n", part, part->ref_count);
+		purple_debug_info("msn", "part unref (%p)[%u]\n", part, part->ref_count);
 
 	if (part->ref_count == 0) {
 		msn_slpmsgpart_destroy(part);
-
-		 return NULL;
 	}
-
-	return part;
 }
 
 void msn_slpmsgpart_set_bin_data(MsnSlpMessagePart *part, const void *data, size_t len)
@@ -234,3 +230,4 @@
 
 	slpmsg->parts = g_list_remove(slpmsg->parts, part);
 }
+
--- a/libpurple/protocols/msn/slpmsg_part.h	Wed Dec 15 00:00:12 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg_part.h	Wed Dec 15 04:17:59 2010 +0000
@@ -32,7 +32,7 @@
 
 struct _MsnSlpMessagePart
 {
-	int ref_count;
+	guint ref_count;
 
 	MsnP2PHeader *header;
 	MsnP2PFooter *footer;
@@ -53,7 +53,7 @@
 
 MsnSlpMessagePart *msn_slpmsgpart_ref(MsnSlpMessagePart *part);
 
-MsnSlpMessagePart *msn_slpmsgpart_unref(MsnSlpMessagePart *part);
+void msn_slpmsgpart_unref(MsnSlpMessagePart *part);
 
 void msn_slpmsgpart_set_bin_data(MsnSlpMessagePart *part, const void *data, size_t len);