/soc/2013/ankitkv/gobjectification: fdd7282fdad6: Merged default...

Ankit Vani a at nevitus.org
Sat Feb 22 16:13:24 EST 2014


Changeset: fdd7282fdad67bc820925351dfddf46a0779fd08
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2014-02-23 02:40 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/fdd7282fdad6

Description:

Merged default branch

diffstat:

 finch/libgnt/gnttree.c   |  25 +++++++++++++++++--------
 libpurple/accounts.c     |  10 +---------
 libpurple/buddylist.c    |  10 +---------
 libpurple/connection.c   |  10 +---------
 libpurple/conversation.c |  30 ++++++------------------------
 libpurple/core.c         |  10 +---------
 libpurple/debug.c        |  10 +---------
 libpurple/dnsquery.c     |  10 +---------
 libpurple/dnssrv.c       |  10 +---------
 libpurple/eventloop.c    |  10 +---------
 libpurple/idle.c         |  10 +---------
 libpurple/notify.c       |  10 +---------
 libpurple/request.c      |  10 +---------
 libpurple/roomlist.c     |  10 +---------
 libpurple/sound.c        |  10 +---------
 libpurple/status.c       |  33 +++++++++++++++------------------
 libpurple/whiteboard.c   |  10 +---------
 libpurple/xfer.c         |  10 +---------
 18 files changed, 53 insertions(+), 185 deletions(-)

diffs (truncated from 595 to 300 lines):

diff --git a/finch/libgnt/gnttree.c b/finch/libgnt/gnttree.c
--- a/finch/libgnt/gnttree.c
+++ b/finch/libgnt/gnttree.c
@@ -70,6 +70,8 @@ struct _GntTreePriv
  * 		 ... Probably not */
 struct _GntTreeRow
 {
+	int box_count;
+
 	void *key;
 	void *data;		/* XXX: unused */
 
@@ -1959,16 +1961,23 @@ GntTreeRow * gnt_tree_row_get_parent(Gnt
  * GntTreeRow GBoxed API
  **************************************************************************/
 static GntTreeRow *
-copy_tree_row(GntTreeRow *row)
+gnt_tree_row_ref(GntTreeRow *row)
 {
-	GntTreeRow *row_new;
-
 	g_return_val_if_fail(row != NULL, NULL);
 
-	row_new = g_new(GntTreeRow, 1);
-	*row_new = *row;
+	row->box_count++;
 
-	return row_new;
+	return row;
+}
+
+static void
+gnt_tree_row_unref(GntTreeRow *row)
+{
+	g_return_if_fail(row != NULL);
+	g_return_if_fail(row->box_count >= 0);
+
+	if (!row->box_count--)
+		free_tree_row(row);
 }
 
 GType
@@ -1978,8 +1987,8 @@ gnt_tree_row_get_type(void)
 
 	if (type == 0) {
 		type = g_boxed_type_register_static("GntTreeRow",
-				(GBoxedCopyFunc)copy_tree_row,
-				(GBoxedFreeFunc)free_tree_row);
+				(GBoxedCopyFunc)gnt_tree_row_ref,
+				(GBoxedFreeFunc)gnt_tree_row_unref);
 	}
 
 	return type;
diff --git a/libpurple/accounts.c b/libpurple/accounts.c
--- a/libpurple/accounts.c
+++ b/libpurple/accounts.c
@@ -834,14 +834,6 @@ purple_account_ui_ops_copy(PurpleAccount
 	return ops_new;
 }
 
-static void
-purple_account_ui_ops_free(PurpleAccountUiOps *ops)
-{
-	g_return_if_fail(ops != NULL);
-
-	g_free(ops);
-}
-
 GType
 purple_account_ui_ops_get_type(void)
 {
@@ -850,7 +842,7 @@ purple_account_ui_ops_get_type(void)
 	if (type == 0) {
 		type = g_boxed_type_register_static("PurpleAccountUiOps",
 				(GBoxedCopyFunc)purple_account_ui_ops_copy,
-				(GBoxedFreeFunc)purple_account_ui_ops_free);
+				(GBoxedFreeFunc)g_free);
 	}
 
 	return type;
diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c
--- a/libpurple/buddylist.c
+++ b/libpurple/buddylist.c
@@ -2030,14 +2030,6 @@ purple_blist_ui_ops_copy(PurpleBlistUiOp
 	return ops_new;
 }
 
-static void
-purple_blist_ui_ops_free(PurpleBlistUiOps *ops)
-{
-	g_return_if_fail(ops != NULL);
-
-	g_free(ops);
-}
-
 GType
 purple_blist_ui_ops_get_type(void)
 {
@@ -2046,7 +2038,7 @@ purple_blist_ui_ops_get_type(void)
 	if (type == 0) {
 		type = g_boxed_type_register_static("PurpleBlistUiOps",
 				(GBoxedCopyFunc)purple_blist_ui_ops_copy,
-				(GBoxedFreeFunc)purple_blist_ui_ops_free);
+				(GBoxedFreeFunc)g_free);
 	}
 
 	return type;
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -601,14 +601,6 @@ purple_connection_ui_ops_copy(PurpleConn
 	return ops_new;
 }
 
-static void
-purple_connection_ui_ops_free(PurpleConnectionUiOps *ops)
-{
-	g_return_if_fail(ops != NULL);
-
-	g_free(ops);
-}
-
 GType
 purple_connection_ui_ops_get_type(void)
 {
@@ -617,7 +609,7 @@ purple_connection_ui_ops_get_type(void)
 	if (type == 0) {
 		type = g_boxed_type_register_static("PurpleConnectionUiOps",
 				(GBoxedCopyFunc)purple_connection_ui_ops_copy,
-				(GBoxedFreeFunc)purple_connection_ui_ops_free);
+				(GBoxedFreeFunc)g_free);
 	}
 
 	return type;
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -310,14 +310,6 @@ purple_conversation_ui_ops_copy(PurpleCo
 	return ops_new;
 }
 
-static void
-purple_conversation_ui_ops_free(PurpleConversationUiOps *ops)
-{
-	g_return_if_fail(ops != NULL);
-
-	g_free(ops);
-}
-
 GType
 purple_conversation_ui_ops_get_type(void)
 {
@@ -326,7 +318,7 @@ purple_conversation_ui_ops_get_type(void
 	if (type == 0) {
 		type = g_boxed_type_register_static("PurpleConversationUiOps",
 				(GBoxedCopyFunc)purple_conversation_ui_ops_copy,
-				(GBoxedFreeFunc)purple_conversation_ui_ops_free);
+				(GBoxedFreeFunc)g_free);
 	}
 
 	return type;
@@ -920,13 +912,15 @@ PurpleConversation *purple_conversation_
 }
 
 static PurpleConversationMessage *
-purple_conversation_message_copy(PurpleConversationMessage *msg)
+copy_conv_message(PurpleConversationMessage *msg)
 {
 	PurpleConversationMessage *newmsg;
 
 	g_return_val_if_fail(msg != NULL, NULL);
 
 	newmsg  = g_new(PurpleConversationMessage, 1);
+	PURPLE_DBUS_REGISTER_POINTER(newmsg, PurpleConversationMessage);
+
 	*newmsg = *msg;
 	newmsg->who   = g_strdup(msg->who);
 	newmsg->what  = g_strdup(msg->what);
@@ -935,18 +929,6 @@ purple_conversation_message_copy(PurpleC
 	return newmsg;
 }
 
-static void
-purple_conversation_message_free(PurpleConversationMessage *msg)
-{
-	g_return_if_fail(msg != NULL);
-
-	g_free(msg->who);
-	g_free(msg->what);
-	g_free(msg->alias);
-
-	g_free(msg);
-}
-
 GType
 purple_conversation_message_get_type(void)
 {
@@ -954,8 +936,8 @@ purple_conversation_message_get_type(voi
 
 	if (type == 0) {
 		type = g_boxed_type_register_static("PurpleConversationMessage",
-				(GBoxedCopyFunc)purple_conversation_message_copy,
-				(GBoxedFreeFunc)purple_conversation_message_free);
+				(GBoxedCopyFunc)copy_conv_message,
+				(GBoxedFreeFunc)free_conv_message);
 	}
 
 	return type;
diff --git a/libpurple/core.c b/libpurple/core.c
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -347,14 +347,6 @@ purple_core_ui_ops_copy(PurpleCoreUiOps 
 	return ops_new;
 }
 
-static void
-purple_core_ui_ops_free(PurpleCoreUiOps *ops)
-{
-	g_return_if_fail(ops != NULL);
-
-	g_free(ops);
-}
-
 GType
 purple_core_ui_ops_get_type(void)
 {
@@ -363,7 +355,7 @@ purple_core_ui_ops_get_type(void)
 	if (type == 0) {
 		type = g_boxed_type_register_static("PurpleCoreUiOps",
 				(GBoxedCopyFunc)purple_core_ui_ops_copy,
-				(GBoxedFreeFunc)purple_core_ui_ops_free);
+				(GBoxedFreeFunc)g_free);
 	}
 
 	return type;
diff --git a/libpurple/debug.c b/libpurple/debug.c
--- a/libpurple/debug.c
+++ b/libpurple/debug.c
@@ -207,14 +207,6 @@ purple_debug_ui_ops_copy(PurpleDebugUiOp
 	return ops_new;
 }
 
-static void
-purple_debug_ui_ops_free(PurpleDebugUiOps *ops)
-{
-	g_return_if_fail(ops != NULL);
-
-	g_free(ops);
-}
-
 GType
 purple_debug_ui_ops_get_type(void)
 {
@@ -223,7 +215,7 @@ purple_debug_ui_ops_get_type(void)
 	if (type == 0) {
 		type = g_boxed_type_register_static("PurpleDebugUiOps",
 				(GBoxedCopyFunc)purple_debug_ui_ops_copy,
-				(GBoxedFreeFunc)purple_debug_ui_ops_free);
+				(GBoxedFreeFunc)g_free);
 	}
 
 	return type;
diff --git a/libpurple/dnsquery.c b/libpurple/dnsquery.c
--- a/libpurple/dnsquery.c
+++ b/libpurple/dnsquery.c
@@ -1022,14 +1022,6 @@ purple_dnsquery_ui_ops_copy(PurpleDnsQue
 	return ops_new;
 }
 
-static void
-purple_dnsquery_ui_ops_free(PurpleDnsQueryUiOps *ops)
-{
-	g_return_if_fail(ops != NULL);
-
-	g_free(ops);
-}
-
 GType
 purple_dnsquery_ui_ops_get_type(void)
 {
@@ -1038,7 +1030,7 @@ purple_dnsquery_ui_ops_get_type(void)
 	if (type == 0) {
 		type = g_boxed_type_register_static("PurpleDnsQueryUiOps",
 				(GBoxedCopyFunc)purple_dnsquery_ui_ops_copy,
-				(GBoxedFreeFunc)purple_dnsquery_ui_ops_free);
+				(GBoxedFreeFunc)g_free);
 	}
 
 	return type;
diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c
--- a/libpurple/dnssrv.c
+++ b/libpurple/dnssrv.c
@@ -1127,14 +1127,6 @@ purple_srv_txt_query_ui_ops_copy(PurpleS
 	return ops_new;
 }
 
-static void
-purple_srv_txt_query_ui_ops_free(PurpleSrvTxtQueryUiOps *ops)
-{
-	g_return_if_fail(ops != NULL);



More information about the Commits mailing list