pidgin: d7425741: Nothing uses this return value, so stop ...

markdoliner at pidgin.im markdoliner at pidgin.im
Mon Nov 22 02:45:32 EST 2010


----------------------------------------------------------------------
Revision: d74257412b7f467114a70c449b96a3930038aac7
Parent:   e7b8f4acdba01f7f2e9c1a4163fc6d2bbefef2ec
Author:   markdoliner at pidgin.im
Date:     11/22/10 02:43:56
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d74257412b7f467114a70c449b96a3930038aac7

Changelog: 

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.

Changes against parent e7b8f4acdba01f7f2e9c1a4163fc6d2bbefef2ec

  patched  libpurple/protocols/msn/msg.c
  patched  libpurple/protocols/msn/msg.h

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msg.c	7e630820b46c867cf25555a75a8a7f998de71002
+++ libpurple/protocols/msn/msg.c	0ca2eb59eaf871f24cdfbffd86582c8e3cf0f45e
@@ -88,11 +88,11 @@ msn_message_ref(MsnMessage *msg)
 	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 @@ msn_message_unref(MsnMessage *msg)
 		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 *
============================================================
--- libpurple/protocols/msn/msg.h	895d2f1b07866919e0faeb02190c0362e699edf5
+++ libpurple/protocols/msn/msg.h	3c1993a6f7312c5255963e244bcf69c64cac2395
@@ -188,7 +188,7 @@ MsnMessage *msn_message_ref(MsnMessage *
  *
  * @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.


More information about the Commits mailing list