/soc/2013/ankitkv/gobjectification: 81638be26f41: Check types of...

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


Changeset: 81638be26f41bf22388a1d701ceca5fc2f26bc6a
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-10-01 03:13 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/81638be26f41

Description:

Check types of GObjects instead of just for NULL values

diffstat:

 libpurple/account.c           |  158 +++++++++++++++++++++---------------------
 libpurple/blistnode.c         |    4 +-
 libpurple/blistnodetypes.c    |   22 ++--
 libpurple/buddylist.c         |   40 +++++-----
 libpurple/cipher.c            |    2 +-
 libpurple/connection.c        |   10 +-
 libpurple/conversation.c      |   28 +++---
 libpurple/conversationtypes.c |   47 ++++++------
 libpurple/presence.c          |   16 ++--
 libpurple/roomlist.c          |   12 +-
 libpurple/status.c            |   38 +++++-----
 libpurple/whiteboard.c        |    8 +-
 libpurple/xfer.c              |   22 ++--
 13 files changed, 202 insertions(+), 205 deletions(-)

diffs (truncated from 1693 to 300 lines):

diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -146,7 +146,7 @@ purple_account_set_register_callback(Pur
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
@@ -158,7 +158,7 @@ static void
 purple_account_register_got_password_cb(PurpleAccount *account,
 	const gchar *password, GError *error, gpointer data)
 {
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	_purple_connection_new(account, TRUE, password);
 }
@@ -166,7 +166,7 @@ purple_account_register_got_password_cb(
 void
 purple_account_register(PurpleAccount *account)
 {
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	purple_debug_info("account", "Registering account %s\n",
 					purple_account_get_username(account));
@@ -193,7 +193,7 @@ purple_account_register_completed(Purple
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
@@ -206,7 +206,7 @@ purple_account_unregister(PurpleAccount 
 {
 	PurpleCallbackBundle *cbb;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	purple_debug_info("account", "Unregistering account %s\n",
 					  purple_account_get_username(account));
@@ -309,7 +309,7 @@ purple_account_connect(PurpleAccount *ac
 	PurplePluginProtocolInfo *prpl_info;
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	username = purple_account_get_username(account);
 
@@ -352,7 +352,7 @@ purple_account_disconnect(PurpleAccount 
 	PurpleAccountPrivate *priv;
 	const char *username;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(!purple_account_is_disconnected(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
@@ -375,7 +375,7 @@ purple_account_is_disconnecting(const Pu
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_val_if_fail(account != NULL, TRUE);
+	g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), TRUE);
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 	return priv->disconnecting;
@@ -388,7 +388,7 @@ purple_account_notify_added(PurpleAccoun
 {
 	PurpleAccountUiOps *ui_ops;
 
-	g_return_if_fail(account     != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(remote_user != NULL);
 
 	ui_ops = purple_accounts_get_ui_ops();
@@ -404,7 +404,7 @@ purple_account_request_add(PurpleAccount
 {
 	PurpleAccountUiOps *ui_ops;
 
-	g_return_if_fail(account     != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(remote_user != NULL);
 
 	ui_ops = purple_accounts_get_ui_ops();
@@ -443,7 +443,7 @@ purple_account_request_close_with_accoun
 {
 	GList *l, *l_next;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	for (l = handles; l != NULL; l = l_next) {
 		PurpleAccountRequestInfo *info = l->data;
@@ -518,7 +518,7 @@ purple_account_request_authorization(Pur
 	int plugin_return;
 	char *response = NULL;
 
-	g_return_val_if_fail(account     != NULL, NULL);
+	g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
 	g_return_val_if_fail(remote_user != NULL, NULL);
 
 	ui_ops = purple_accounts_get_ui_ops();
@@ -619,7 +619,7 @@ purple_account_request_change_password(P
 	PurplePluginProtocolInfo *prpl_info = NULL;
 	char primary[256];
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(purple_account_is_connected(account));
 
 	gc = purple_account_get_connection(account);
@@ -684,7 +684,7 @@ purple_account_request_change_user_info(
 	PurpleConnection *gc;
 	char primary[256];
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(purple_account_is_connected(account));
 
 	gc = purple_account_get_connection(account);
@@ -709,7 +709,7 @@ purple_account_set_username(PurpleAccoun
 	PurpleBlistUiOps *blist_ops;
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
@@ -731,7 +731,7 @@ purple_account_set_password(PurpleAccoun
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
@@ -757,7 +757,7 @@ purple_account_set_private_alias(PurpleA
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
@@ -787,7 +787,7 @@ purple_account_set_user_info(PurpleAccou
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
@@ -801,7 +801,7 @@ void purple_account_set_buddy_icon_path(
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
@@ -816,7 +816,7 @@ purple_account_set_protocol_id(PurpleAcc
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account     != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(protocol_id != NULL);
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
@@ -832,7 +832,7 @@ purple_account_set_connection(PurpleAcco
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 	priv->gc = gc;
@@ -843,7 +843,7 @@ purple_account_set_remember_password(Pur
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 	priv->remember_pass = value;
@@ -854,7 +854,7 @@ purple_account_set_remember_password(Pur
 void
 purple_account_set_check_mail(PurpleAccount *account, gboolean value)
 {
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	purple_account_set_bool(account, "check-mail", value);
 }
@@ -867,7 +867,7 @@ purple_account_set_enabled(PurpleAccount
 	PurpleAccountPrivate *priv;
 	gboolean was_enabled = FALSE;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(ui      != NULL);
 
 	was_enabled = purple_account_get_enabled(account, ui);
@@ -896,7 +896,7 @@ purple_account_set_proxy_info(PurpleAcco
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
@@ -913,7 +913,7 @@ purple_account_set_privacy_type(PurpleAc
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 	priv->privacy_type = privacy_type;
@@ -924,7 +924,7 @@ purple_account_set_status_types(PurpleAc
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
@@ -966,7 +966,7 @@ purple_account_set_status_list(PurpleAcc
 {
 	PurpleStatus *status;
 
-	g_return_if_fail(account   != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(status_id != NULL);
 
 	status = purple_account_get_status(account, status_id);
@@ -1017,7 +1017,7 @@ purple_account_set_public_alias(PurpleAc
 	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(purple_account_is_connected(account));
 
 	gc = purple_account_get_connection(account);
@@ -1057,7 +1057,7 @@ purple_account_get_public_alias(PurpleAc
 	PurplePlugin *prpl = NULL;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(purple_account_is_connected(account));
 
 	gc = purple_account_get_connection(account);
@@ -1084,7 +1084,7 @@ purple_account_get_silence_suppression(c
 void
 purple_account_set_silence_suppression(PurpleAccount *account, gboolean value)
 {
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	purple_account_set_bool(account, "silence-suppression", value);
 }
@@ -1105,7 +1105,7 @@ purple_account_clear_settings(PurpleAcco
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 	g_hash_table_destroy(priv->settings);
@@ -1119,7 +1119,7 @@ purple_account_remove_setting(PurpleAcco
 {
 	PurpleAccountPrivate *priv;
 
-	g_return_if_fail(account != NULL);
+	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(setting != NULL);
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);



More information about the Commits mailing list