changeset 31394: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 a76cf8ecb0c5
files libpurple/protocols/msn/msg.c libpurple/protocols/msn/msg.h
diffstat 2 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msg.c	Mon Nov 22 07:40:23 2010 +0000
+++ b/libpurple/protocols/msn/msg.c	Mon Nov 22 07:43:56 2010 +0000
@@ -88,11 +88,11 @@
 	return msg;
 }
 
-MsnMessage *
+void
 msn_message_unref(MsnMessage *msg)
 {
-	g_return_val_if_fail(msg != NULL, NULL);
-	g_return_val_if_fail(msg->ref_count > 0, NULL);
+	g_return_if_fail(msg != NULL);
+	g_return_if_fail(msg->ref_count > 0);
 
 	msg->ref_count--;
 
@@ -100,13 +100,7 @@
 		purple_debug_info("msn", "message unref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count);
 
 	if (msg->ref_count == 0)
-	{
 		msn_message_destroy(msg);
-
-		return NULL;
-	}
-
-	return msg;
 }
 
 MsnMessage *
--- a/libpurple/protocols/msn/msg.h	Mon Nov 22 07:40:23 2010 +0000
+++ b/libpurple/protocols/msn/msg.h	Mon Nov 22 07:43:56 2010 +0000
@@ -188,7 +188,7 @@
  *
  * @return @a msg, or @c NULL if the new count is 0.
  */
-MsnMessage *msn_message_unref(MsnMessage *msg);
+void msn_message_unref(MsnMessage *msg);
 
 /**
  * Generates the payload data of a message.