changeset 17124:601594a64190

Style changes + removed unnecessary NULL checks.
author Gabriel Schulhof <nix@go-nix.ca>
date Wed, 16 May 2007 19:35:17 +0000
parents 176d0fc8bc16
children 34a7860e0084 9d5121f2ab5d
files libpurple/core.c libpurple/core.h libpurple/plugin.c pidgin/gtkconv.c pidgin/gtkmain.c
diffstat 5 files changed, 21 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/core.c	Tue May 15 20:41:36 2007 +0000
+++ b/libpurple/core.c	Wed May 16 19:35:17 2007 +0000
@@ -288,10 +288,10 @@
 	DBusError dbus_error;
 	char *remote_user_dir = NULL;
 
-	if (NULL == (dbus_connection = purple_dbus_get_connection()))
+	if ((dbus_connection = purple_dbus_get_connection()) == NULL)
 		return NULL;
 
-	if (NULL == (msg = dbus_message_new_method_call(DBUS_SERVICE_PURPLE, DBUS_PATH_PURPLE, DBUS_INTERFACE_PURPLE, "PurpleUserDir")))
+	if ((msg = dbus_message_new_method_call(DBUS_SERVICE_PURPLE, DBUS_PATH_PURPLE, DBUS_INTERFACE_PURPLE, "PurpleUserDir")) == NULL)
 		return NULL;
 
 	dbus_error_init(&dbus_error);
@@ -299,15 +299,14 @@
 	dbus_message_unref(msg);
 	dbus_error_free(&dbus_error);
 
-	if (NULL != reply)
-		{
+	if (reply) {
 		dbus_error_init(&dbus_error);
 		dbus_message_get_args(reply, &dbus_error, DBUS_TYPE_STRING, &remote_user_dir, DBUS_TYPE_INVALID);
-		if (NULL != remote_user_dir)
+		if (remote_user_dir)
 			remote_user_dir = g_strdup(remote_user_dir);
 		dbus_error_free(&dbus_error);
 		dbus_message_unref(reply);
-		}
+	}
 
 	return remote_user_dir;
 }
@@ -316,16 +315,18 @@
 {
 	DBusError dbus_error;
 	DBusMessage *msg = NULL, *reply = NULL;
-	DBusConnection *dbus_connection = purple_dbus_get_connection();
+	DBusConnection *dbus_connection = NULL;
 
-	if (NULL == dbus_connection) return;
+	if ((dbus_connection = purple_dbus_get_connection()) == NULL)
+		return;
 
-	if (NULL == (msg = dbus_message_new_method_call(DBUS_SERVICE_PURPLE, DBUS_PATH_PURPLE, DBUS_INTERFACE_PURPLE, "PurpleBlistShow")))
+	if ((msg = dbus_message_new_method_call(DBUS_SERVICE_PURPLE, DBUS_PATH_PURPLE, DBUS_INTERFACE_PURPLE, "PurpleBlistShow")) == NULL)
 		return ;
 
 	dbus_error_init(&dbus_error);
-	if (NULL != (reply = dbus_connection_send_with_reply_and_block(dbus_connection, msg, 5000, &dbus_error)))
+	if ((reply = dbus_connection_send_with_reply_and_block(dbus_connection, msg, 5000, &dbus_error)) != NULL) {
 		dbus_message_unref(msg);
+	}
 	dbus_error_free(&dbus_error);
 }
 #endif /* HAVE_DBUS */
@@ -334,18 +335,17 @@
 {
 gboolean is_single_instance = TRUE;
 #ifdef HAVE_DBUS
-	if (is_single_instance) /* in the future, other mechanisms might have already set this to FALSE */
+	/* in the future, other mechanisms might have already set this to FALSE */
+	if (is_single_instance) {
 		if (!purple_dbus_is_owner()) {
 			const char *user_dir = purple_user_dir();
 			char *dbus_owner_user_dir = purple_dbus_owner_user_dir();
 
 			if (NULL == user_dir && NULL != dbus_owner_user_dir)
 				is_single_instance = TRUE;
-			else
-			if (NULL != user_dir && NULL == dbus_owner_user_dir)
+			else if (NULL != user_dir && NULL == dbus_owner_user_dir)
 				is_single_instance = TRUE;
-			else
-			if (NULL == user_dir && NULL == dbus_owner_user_dir)
+			else if (NULL == user_dir && NULL == dbus_owner_user_dir)
 				is_single_instance = FALSE;
 			else
 				is_single_instance = strcmp(dbus_owner_user_dir, user_dir);
@@ -355,6 +355,7 @@
 
 			g_free(dbus_owner_user_dir);
 		}
+	}
 #endif /* HAVE_DBUS */
 	return is_single_instance;
 }
--- a/libpurple/core.h	Tue May 15 20:41:36 2007 +0000
+++ b/libpurple/core.h	Wed May 16 19:35:17 2007 +0000
@@ -124,8 +124,8 @@
 /**
  * Ensures that only one instance is running.
  *
- * @return A boolean such that success indicates that this is the first instance,
- *         whereas failure indicates that there is another instance running.
+ * @return A boolean such that @c TRUE indicates that this is the first instance,
+ *         whereas @c FALSE indicates that there is another instance running.
  */
 gboolean purple_core_ensure_single_instance(void);
 
--- a/libpurple/plugin.c	Tue May 15 20:41:36 2007 +0000
+++ b/libpurple/plugin.c	Wed May 16 19:35:17 2007 +0000
@@ -359,7 +359,7 @@
 		purple_plugin_destroy(plugin);
 		return NULL;
 	}
-	else if (plugin->info->ui_requirement && NULL != purple_core_get_ui() &&
+	else if (plugin->info->ui_requirement &&
 			strcmp(plugin->info->ui_requirement, purple_core_get_ui()))
 	{
 		plugin->error = g_strdup_printf(_("You are using %s, but this plugin requires %s."),
--- a/pidgin/gtkconv.c	Tue May 15 20:41:36 2007 +0000
+++ b/pidgin/gtkconv.c	Wed May 16 19:35:17 2007 +0000
@@ -7996,9 +7996,6 @@
 	purple_prefs_disconnect_by_handle(win);
 	window_list = g_list_remove(window_list, win);
 
-	if (NULL == win)
-		return ;
-
 	/* Close the "Find" dialog if it's open */
 	if (win->dialogs.search)
 		gtk_widget_destroy(win->dialogs.search);
--- a/pidgin/gtkmain.c	Tue May 15 20:41:36 2007 +0000
+++ b/pidgin/gtkmain.c	Wed May 16 19:35:17 2007 +0000
@@ -730,13 +730,12 @@
 		abort();
 	}
 
-	if (!purple_core_ensure_single_instance ())
-		{
+	if (!purple_core_ensure_single_instance()) {
 #ifdef HAVE_SIGNAL_H
 		g_free(segfault_message);
 #endif
 		return 0 ;
-		}
+	}
 		
 
 	/* TODO: Move blist loading into purple_blist_init() */