pidgin: e2886fb2: As Mark did before, we probably don't ne...

qulogic at pidgin.im qulogic at pidgin.im
Thu Dec 16 02:27:37 EST 2010


----------------------------------------------------------------------
Revision: e2886fb28589e96d33e8377984790990878f27e7
Parent:   4387bc0db265ded1b97c5dfd14ddf121236f63e1
Author:   qulogic at pidgin.im
Date:     12/14/10 23:17:59
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e2886fb28589e96d33e8377984790990878f27e7

Changelog: 

As Mark did before, we probably don't need a return value from these
unref functions. Also, make the ref counts unsigned.

Changes against parent 4387bc0db265ded1b97c5dfd14ddf121236f63e1

  patched  libpurple/protocols/msn/command.c
  patched  libpurple/protocols/msn/command.h
  patched  libpurple/protocols/msn/msg.c
  patched  libpurple/protocols/msn/msg.h
  patched  libpurple/protocols/msn/slplink.h
  patched  libpurple/protocols/msn/slpmsg_part.c
  patched  libpurple/protocols/msn/slpmsg_part.h

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msg.c	0ca2eb59eaf871f24cdfbffd86582c8e3cf0f45e
+++ libpurple/protocols/msn/msg.c	f5492bd25ff4c82c56eb39b61ae4d07ac40a9a9b
@@ -83,7 +83,7 @@ msn_message_ref(MsnMessage *msg)
 	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 @@ msn_message_unref(MsnMessage *msg)
 	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);
============================================================
--- libpurple/protocols/msn/msg.h	3c1993a6f7312c5255963e244bcf69c64cac2395
+++ libpurple/protocols/msn/msg.h	97aed3258140e4249a0dcf27f9d6112ae89b7738
@@ -74,7 +74,7 @@ struct _MsnMessage
  */
 struct _MsnMessage
 {
-	size_t ref_count;           /**< The reference count.       */
+	guint ref_count;        /**< The reference count.       */
 
 	MsnMsgType type;
 
@@ -89,8 +89,8 @@ struct _MsnMessage
 	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;
============================================================
--- libpurple/protocols/msn/command.c	90c49a3f391bbb47402fb4c5023406eafb11d240
+++ libpurple/protocols/msn/command.c	137736e73ccd9f23002ed2d5a771672626724bdc
@@ -107,19 +107,17 @@ msn_command_ref(MsnCommand *cmd)
 	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;
-}
============================================================
--- libpurple/protocols/msn/command.h	abf8374ebbabe161d9c8ffa0676e7a0bbafebb5d
+++ libpurple/protocols/msn/command.h	42a7bc1d15979423b456f31ee060ee0340ccce09
@@ -43,7 +43,7 @@ struct _MsnCommand
 	char **params;
 	int param_count;
 
-	int ref_count;
+	guint ref_count;
 
 	MsnTransaction *trans;
 
@@ -85,8 +85,8 @@ MsnCommand *msn_command_ref(MsnCommand *
  *
  * @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 */
+
============================================================
--- libpurple/protocols/msn/slplink.h	16fc408891645426e2ea4970f79487fee0d44744
+++ libpurple/protocols/msn/slplink.h	0a3f561f407f4b9503d352ba5be546fc82da72d1
@@ -42,7 +42,7 @@ struct _MsnSlpLink
 	MsnSwitchBoard *swboard;
 	MsnDirectConn *dc;
 
-	int refs;
+	guint refs;
 
 	char *remote_user;
 
============================================================
--- libpurple/protocols/msn/slpmsg_part.c	ae95b349f68711a98124dec5b808e119fd236089
+++ libpurple/protocols/msn/slpmsg_part.c	1586ca5ced28deee344c74bca8569d9167062e9c
@@ -102,31 +102,27 @@ MsnSlpMessagePart *msn_slpmsgpart_ref(Ms
 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 @@ msn_slpmsgpart_nak(MsnSlpMessagePart *pa
 
 	slpmsg->parts = g_list_remove(slpmsg->parts, part);
 }
+
============================================================
--- libpurple/protocols/msn/slpmsg_part.h	46266d2ef870c8b0099282e468571131d866d5e0
+++ libpurple/protocols/msn/slpmsg_part.h	8ecf00891a53f9c4ff4aff3fe99dafbd4b53beb1
@@ -32,7 +32,7 @@ struct _MsnSlpMessagePart
 
 struct _MsnSlpMessagePart
 {
-	int ref_count;
+	guint ref_count;
 
 	MsnP2PHeader *header;
 	MsnP2PFooter *footer;
@@ -53,7 +53,7 @@ MsnSlpMessagePart *msn_slpmsgpart_ref(Ms
 
 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);
 


More information about the Commits mailing list