/soc/2013/ankitkv/gobjectification: b62140058cd3: Check for vali...

Ankit Vani a at nevitus.org
Mon Sep 30 18:05:11 EDT 2013


Changeset: b62140058cd382f2ac4c611b0c0c33a81044c919
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-10-01 03:34 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/b62140058cd3

Description:

Check for valid PurpleProtocols

diffstat:

 libpurple/conversation.c      |  2 +-
 libpurple/conversationtypes.c |  6 +++---
 libpurple/protocol.c          |  6 +++---
 libpurple/protocols.c         |  4 ++--
 libpurple/roomlist.c          |  2 +-
 libpurple/whiteboard.c        |  2 +-
 libpurple/xfer.c              |  2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)

diffs (129 lines):

diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -899,7 +899,7 @@ purple_conversation_get_max_message_size
 	protocol = purple_connection_get_protocol(
 		purple_conversation_get_connection(conv));
 
-	g_return_val_if_fail(protocol != NULL, 0);
+	g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), 0);
 
 	return purple_protocol_client_iface_get_max_message_size(protocol, conv);
 }
diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -848,7 +848,7 @@ purple_chat_conversation_add_users(Purpl
 	gc = purple_conversation_get_connection(conv);
 	g_return_if_fail(PURPLE_IS_CONNECTION(gc));
 	protocol = purple_connection_get_protocol(gc);
-	g_return_if_fail(protocol != NULL);
+	g_return_if_fail(PURPLE_IS_PROTOCOL(protocol));
 
 	ul = users;
 	fl = flags;
@@ -955,7 +955,7 @@ purple_chat_conversation_rename_user(Pur
 	gc = purple_conversation_get_connection(conv);
 	g_return_if_fail(PURPLE_IS_CONNECTION(gc));
 	protocol = purple_connection_get_protocol(gc);
-	g_return_if_fail(protocol != NULL);
+	g_return_if_fail(PURPLE_IS_PROTOCOL(protocol));
 
 	if (purple_strequal(priv->nick, purple_normalize(account, old_user))) {
 		const char *alias;
@@ -1078,7 +1078,7 @@ purple_chat_conversation_remove_users(Pu
 	gc = purple_conversation_get_connection(conv);
 	g_return_if_fail(PURPLE_IS_CONNECTION(gc));
 	protocol = purple_connection_get_protocol(gc);
-	g_return_if_fail(protocol != NULL);
+	g_return_if_fail(PURPLE_IS_PROTOCOL(protocol));
 
 	ops  = purple_conversation_get_ui_ops(conv);
 
diff --git a/libpurple/protocol.c b/libpurple/protocol.c
--- a/libpurple/protocol.c
+++ b/libpurple/protocol.c
@@ -87,7 +87,7 @@ purple_protocol_get_whiteboard_ops(const
 static void
 user_splits_free(PurpleProtocol *protocol)
 {
-	g_return_if_fail(protocol != NULL);
+	g_return_if_fail(PURPLE_IS_PROTOCOL(protocol));
 
 	while (protocol->user_splits) {
 		PurpleAccountUserSplit *split = protocol->user_splits->data;
@@ -100,7 +100,7 @@ user_splits_free(PurpleProtocol *protoco
 static void
 protocol_options_free(PurpleProtocol *protocol)
 {
-	g_return_if_fail(protocol != NULL);
+	g_return_if_fail(PURPLE_IS_PROTOCOL(protocol));
 
 	while (protocol->protocol_options) {
 		PurpleAccountOption *option = protocol->protocol_options->data;
@@ -114,7 +114,7 @@ protocol_options_free(PurpleProtocol *pr
 static void
 icon_spec_free(PurpleProtocol *protocol)
 {
-	g_return_if_fail(protocol != NULL);
+	g_return_if_fail(PURPLE_IS_PROTOCOL(protocol));
 
 	g_free(protocol->icon_spec);
 	protocol->icon_spec = NULL;
diff --git a/libpurple/protocols.c b/libpurple/protocols.c
--- a/libpurple/protocols.c
+++ b/libpurple/protocols.c
@@ -679,7 +679,7 @@ purple_protocol_got_media_caps(PurpleAcc
 gssize
 purple_protocol_get_max_message_size(PurpleProtocol *protocol)
 {
-	g_return_val_if_fail(protocol != NULL, 0);
+	g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), 0);
 
 	return purple_protocol_client_iface_get_max_message_size(protocol, NULL);
 }
@@ -844,7 +844,7 @@ purple_protocols_add(GType protocol_type
 
 gboolean purple_protocols_remove(PurpleProtocol *protocol, GError **error)
 {
-	g_return_val_if_fail(protocol != NULL, FALSE);
+	g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), FALSE);
 	g_return_val_if_fail(purple_protocol_get_id(protocol) != NULL, FALSE);
 
 	if (purple_protocols_find(purple_protocol_get_id(protocol)) == NULL) {
diff --git a/libpurple/roomlist.c b/libpurple/roomlist.c
--- a/libpurple/roomlist.c
+++ b/libpurple/roomlist.c
@@ -426,7 +426,7 @@ PurpleRoomlist *purple_roomlist_new(Purp
 
 	protocol = purple_protocols_find(purple_account_get_protocol_id(account));
 
-	g_return_val_if_fail(protocol != NULL, NULL);
+	g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), NULL);
 
 	if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, FACTORY_IFACE, roomlist_new))
 		list = purple_protocol_factory_iface_roomlist_new(protocol, account);
diff --git a/libpurple/whiteboard.c b/libpurple/whiteboard.c
--- a/libpurple/whiteboard.c
+++ b/libpurple/whiteboard.c
@@ -515,7 +515,7 @@ PurpleWhiteboard *purple_whiteboard_new(
 
 	protocol = purple_protocols_find(purple_account_get_protocol_id(account));
 
-	g_return_val_if_fail(protocol != NULL, NULL);
+	g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), NULL);
 
 	if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, FACTORY_IFACE, whiteboard_new))
 		wb = purple_protocol_factory_iface_whiteboard_new(protocol, account,
diff --git a/libpurple/xfer.c b/libpurple/xfer.c
--- a/libpurple/xfer.c
+++ b/libpurple/xfer.c
@@ -2346,7 +2346,7 @@ purple_xfer_new(PurpleAccount *account, 
 
 	protocol = purple_protocols_find(purple_account_get_protocol_id(account));
 
-	g_return_val_if_fail(protocol != NULL, NULL);
+	g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), NULL);
 
 	if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, FACTORY_IFACE, xfer_new))
 		xfer = purple_protocol_factory_iface_xfer_new(protocol, account, type,



More information about the Commits mailing list