changeset 14035:8bda65b88e49

[gaim-migrate @ 16638] A bunch of small changes. Mostly remove "if not null" checks before calling g_free, g_list_free, g_slist_free and g_strdup. Also use g_list_foreach() to call g_free to free strings in an array. And some whitespace changes here and there. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 05 Aug 2006 08:27:39 +0000
parents 0839a7b71325
children 5c928f4c0105
files plugins/codeinline.c plugins/contact_priority.c plugins/dbus-example.c plugins/history.c plugins/log_reader.c plugins/timestamp.c src/account.c src/accountopt.c src/blist.c src/buddyicon.c src/cipher.c src/cmds.c src/connection.c src/conversation.c src/core.c src/dbus-define-api.h src/dbus-server.h src/dbus-useful.c src/dbus-useful.h src/ft.c src/gaim-client-example.c src/gaim-client.c src/gtkaccount.c src/gtkblist.c src/gtkconv.c src/gtkdebug.c src/gtkft.c src/gtkimhtml.c src/gtkimhtmltoolbar.c src/gtklog.c src/gtkpluginpref.c src/gtkpounce.c src/gtkprefs.c src/gtkprivacy.c src/gtkrequest.c src/gtkroomlist.c src/gtksound.c src/gtkstatusbox.c src/gtkthemes.c src/gtkutils.c src/imgstore.c src/log.c src/notify.c src/plugin.c src/pluginpref.c src/pounce.c src/prefs.c src/protocols/oscar/oscar.c src/protocols/qq/qq.c src/proxy.c src/prpl.c src/request.c src/roomlist.c src/server.c src/signals.c src/socket.c src/status.c src/util.c src/value.c src/whiteboard.c src/xmlnode.c
diffstat 61 files changed, 508 insertions(+), 760 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/codeinline.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/plugins/codeinline.c	Sat Aug 05 08:27:39 2006 +0000
@@ -48,12 +48,12 @@
 
 static gboolean
 plugin_load(GaimPlugin *plugin)
-{       
+{
      void *handle = gaim_conversations_get_handle();
      plugin_handle = plugin;
-     gaim_signal_connect(handle, "writing-im-msg", plugin, 
+     gaim_signal_connect(handle, "writing-im-msg", plugin,
                 GAIM_CALLBACK(outgoing_msg_cb), NULL);
-     
+
      return TRUE;
 }
 
--- a/plugins/contact_priority.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/plugins/contact_priority.c	Sat Aug 05 08:27:39 2006 +0000
@@ -99,12 +99,12 @@
 
 		hbox = gtk_hbox_new(FALSE, 5);
 		gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-	
+
 		label = gtk_label_new_with_mnemonic(_(statuses[i].description));
 		gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 		gtk_size_group_add_widget(sg, label);
 		gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
-	
+
 		adj = gtk_adjustment_new(gaim_prefs_get_int(pref), -500, 500, 1, 1, 1);
 		spin = gtk_spin_button_new((GtkAdjustment *)adj, 1, 0);
 		g_signal_connect(G_OBJECT(spin), "value-changed", G_CALLBACK(pref_update), pref);
--- a/plugins/dbus-example.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/plugins/dbus-example.c	Sat Aug 05 08:27:39 2006 +0000
@@ -51,7 +51,7 @@
 #include "dbus-bindings.h"
 
 typedef struct {
-    char *text;
+	char *text;
 } GaimText;
 
 /* This makes the structure GaimText visible to the gaim-dbus type
@@ -59,7 +59,7 @@
    on, we will be able to register pointers to structures of this
    type.  You to dbus-define types you want to be directly accessible
    by external applications. */
-GAIM_DBUS_DEFINE_TYPE(GaimText)	
+GAIM_DBUS_DEFINE_TYPE(GaimText)
 
 /* Here we make four functions accessible to other applications by
    DBus.  These functions can access types defined in gaim proper
@@ -78,30 +78,30 @@
 static GaimText hello;
 
 /* Here come the definitions of the four exported functions. */
-GaimText* dbus_example_get_hello_object(void) 
+GaimText* dbus_example_get_hello_object(void)
 {
-    return &hello;
+	return &hello;
 }
 
-void dbus_example_set_text(GaimText *obj, const char *text) 
+void dbus_example_set_text(GaimText *obj, const char *text)
 {
-    if (obj != NULL) {
-	g_free(obj->text);
-	obj->text = g_strdup(text);
-    }
+	if (obj != NULL) {
+		g_free(obj->text);
+		obj->text = g_strdup(text);
+	}
 }
 
-const char *dbus_example_get_text(GaimText *obj) 
+const char *dbus_example_get_text(GaimText *obj)
 {
-    if (obj != NULL) 
-	return obj->text;
-    else
-	return NULL;
+	if (obj != NULL)
+		return obj->text;
+	else
+		return NULL;
 }
 
-const char *dbus_example_get_buddy_name(GaimBuddy *buddy) 
+const char *dbus_example_get_buddy_name(GaimBuddy *buddy)
 {
-    return gaim_buddy_get_name(buddy);
+	return gaim_buddy_get_name(buddy);
 }
 
 /* And now standard plugin stuff */
@@ -111,33 +111,33 @@
 {
 	GAIM_DBUS_RETURN_FALSE_IF_DISABLED(plugin);
 
-    /* First, we have to register our four exported functions with the
-       main gaim dbus loop.  Without this statement, the gaim dbus
-       code wouldn't know about our functions. */
-    GAIM_DBUS_REGISTER_BINDINGS(plugin);
+	/* First, we have to register our four exported functions with the
+	   main gaim dbus loop.  Without this statement, the gaim dbus
+	   code wouldn't know about our functions. */
+	GAIM_DBUS_REGISTER_BINDINGS(plugin);
 
-    /* Then, we register the hello object of type GaimText.  Note that
-       pointer registrations / unregistrations are completely dynamic;
-       they don't have to be made when the plugin is loaded /
-       unloaded.  Without this statement the dbus gaim code wouldn't
-       know about the hello object.  */
-    GAIM_DBUS_REGISTER_POINTER(&hello, GaimText);
+	/* Then, we register the hello object of type GaimText.  Note that
+	   pointer registrations / unregistrations are completely dynamic;
+	   they don't have to be made when the plugin is loaded /
+	   unloaded.  Without this statement the dbus gaim code wouldn't
+	   know about the hello object.  */
+	GAIM_DBUS_REGISTER_POINTER(&hello, GaimText);
 
-    hello.text = g_strdup("Hello.");
-    
-    return TRUE;
+	hello.text = g_strdup("Hello.");
+
+	return TRUE;
 }
 
 
 static gboolean
 plugin_unload(GaimPlugin *plugin)
 {
-    g_free(hello.text);
+	g_free(hello.text);
 
-    /* It is necessary to unregister all pointers registered by the module. */
-    GAIM_DBUS_UNREGISTER_POINTER(&hello);
+	/* It is necessary to unregister all pointers registered by the module. */
+	GAIM_DBUS_UNREGISTER_POINTER(&hello);
 
-    return TRUE;
+	return TRUE;
 }
 
 static GaimPluginInfo info =
--- a/plugins/history.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/plugins/history.c	Sat Aug 05 08:27:39 2006 +0000
@@ -90,7 +90,7 @@
 		if (logs == NULL)
 			logs = gaim_log_get_logs(GAIM_LOG_IM, name, account);
 		else
-        		logs = g_list_sort(logs, gaim_log_compare);
+			logs = g_list_sort(logs, gaim_log_compare);
 	}
 	else if (convtype == GAIM_CONV_TYPE_CHAT)
 	{
--- a/plugins/log_reader.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/plugins/log_reader.c	Sat Aug 05 08:27:39 2006 +0000
@@ -300,7 +300,7 @@
 
 		if (!data->path || stat(data->path, &st))
 			st.st_size = 0;
-	
+
 		return st.st_size;
 	}
 
@@ -399,7 +399,7 @@
 	g_return_val_if_fail(log != NULL, g_strdup(""));
 
 	data = log->logger_data;
-	
+
 	/* TODO: Do something here. */
 	return g_strdup("");
 }
--- a/plugins/timestamp.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/plugins/timestamp.c	Sat Aug 05 08:27:39 2006 +0000
@@ -120,7 +120,7 @@
 		gaim_conversation_set_data(conv, "timestamp-initialized", GINT_TO_POINTER(TRUE));
 		gaim_conversation_set_data(conv, "timestamp-enabled", GINT_TO_POINTER(TRUE));
 		gaim_conversation_set_data(conv, "timestamp-conv-active", GINT_TO_POINTER(TRUE));
-		gtk_text_buffer_create_tag (buffer, "TIMESTAMP", "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, 
+		gtk_text_buffer_create_tag (buffer, "TIMESTAMP", "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER,
 					    "weight", PANGO_WEIGHT_BOLD, NULL);
 		do_timestamp(conv);
 	}
--- a/src/account.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/account.c	Sat Aug 05 08:27:39 2006 +0000
@@ -792,8 +792,7 @@
 {
 	GaimAccountSetting *setting = (GaimAccountSetting *)data;
 
-	if (setting->ui != NULL)
-		g_free(setting->ui);
+	g_free(setting->ui);
 
 	if (setting->type == GAIM_PREF_STRING)
 		g_free(setting->value.string);
@@ -1178,7 +1177,7 @@
 	g_return_if_fail(account != NULL);
 
 	g_free(account->username);
-	account->username = (username == NULL ? NULL : g_strdup(username));
+	account->username = g_strdup(username);
 
 	schedule_accounts_save();
 }
@@ -1189,8 +1188,7 @@
 	g_return_if_fail(account != NULL);
 
 	g_free(account->password);
-	account->password = NULL;
-	account->password = (password == NULL ? NULL : g_strdup(password));
+	account->password = g_strdup(password);
 
 	schedule_accounts_save();
 }
@@ -1212,7 +1210,7 @@
 	{
 		char *old = account->alias;
 
-		account->alias = (alias == NULL ? NULL : g_strdup(alias));
+		account->alias = g_strdup(alias);
 		gaim_signal_emit(gaim_accounts_get_handle(), "account-alias-changed",
 						 account, old);
 		g_free(old);
@@ -1227,7 +1225,7 @@
 	g_return_if_fail(account != NULL);
 
 	g_free(account->user_info);
-	account->user_info = (user_info == NULL ? NULL : g_strdup(user_info));
+	account->user_info = g_strdup(user_info);
 
 	schedule_accounts_save();
 }
@@ -1263,7 +1261,7 @@
 	}
 
 	g_free(account->buddy_icon);
-	account->buddy_icon = (icon == NULL ? NULL : g_strdup(icon));
+	account->buddy_icon = g_strdup(icon);
 	if (gaim_account_is_connected(account))
 	{
 		char *filename = gaim_buddy_icons_get_full_path(icon);
@@ -1362,11 +1360,7 @@
 	/* Old with the old... */
 	if (account->status_types != NULL)
 	{
-		GList *l;
-
-		for (l = account->status_types; l != NULL; l = l->next)
-			gaim_status_type_destroy((GaimStatusType *)l->data);
-
+		g_list_foreach(account->status_types, (GFunc)gaim_status_type_destroy, NULL);
 		g_list_free(account->status_types);
 	}
 
--- a/src/accountopt.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/accountopt.c	Sat Aug 05 08:27:39 2006 +0000
@@ -87,8 +87,7 @@
 	if (option == NULL)
 		return NULL;
 
-	if (default_value != NULL)
-		option->default_value.string = g_strdup(default_value);
+	option->default_value.string = g_strdup(default_value);
 
 	return option;
 }
@@ -159,10 +158,8 @@
 	g_return_if_fail(option != NULL);
 	g_return_if_fail(option->type == GAIM_PREF_STRING);
 
-	if (option->default_value.string != NULL)
-		g_free(option->default_value.string);
-
-	option->default_value.string = (value == NULL ? NULL : g_strdup(value));
+	g_free(option->default_value.string);
+	option->default_value.string = g_strdup(value);
 }
 
 void
@@ -310,8 +307,7 @@
 
 	split->text = g_strdup(text);
 	split->field_sep = sep;
-	split->default_value = (default_value == NULL
-							? NULL : g_strdup(default_value));
+	split->default_value = g_strdup(default_value);
 
 	return split;
 }
@@ -321,12 +317,8 @@
 {
 	g_return_if_fail(split != NULL);
 
-	if (split->text != NULL)
-		g_free(split->text);
-
-	if (split->default_value != NULL)
-		g_free(split->default_value);
-
+	g_free(split->text);
+	g_free(split->default_value);
 	g_free(split);
 }
 
--- a/src/blist.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/blist.c	Sat Aug 05 08:27:39 2006 +0000
@@ -627,21 +627,21 @@
 
 		if (!gaim_account_is_connected(buddy->account))
 			continue;
- 		if (new_priority == NULL)
- 			new_priority = buddy;
- 		else
- 		{
- 			int cmp;
+		if (new_priority == NULL)
+			new_priority = buddy;
+		else
+		{
+			int cmp;
 
 			cmp = gaim_presence_compare(gaim_buddy_get_presence(new_priority),
 			                            gaim_buddy_get_presence(buddy));
 
- 			if (cmp > 0 || (cmp == 0 &&
+			if (cmp > 0 || (cmp == 0 &&
 			                gaim_prefs_get_bool("/core/contact/last_match")))
- 			{
- 				new_priority = buddy;
- 			}
- 		}
+			{
+				new_priority = buddy;
+			}
+		}
 	}
 
 	contact->priority = new_priority;
@@ -1055,7 +1055,7 @@
 				/* Make a list of what the groups each buddy is in */
 				for(cur = buddies; cur; cur = cur->next) {
 					GaimBlistNode *node = (GaimBlistNode *)cur->data;
-					groups = g_list_append(groups, node->parent->parent);
+					groups = g_list_prepend(groups, node->parent->parent);
 				}
 
 				gaim_account_remove_buddies(account, buddies, groups);
@@ -2037,7 +2037,7 @@
 const char *gaim_chat_get_name(GaimChat *chat)
 {
 	struct proto_chat_entry *pce;
-	GList *parts, *tmp;
+	GList *parts;
 	char *ret;
 
 	g_return_val_if_fail(chat != NULL, NULL);
@@ -2048,8 +2048,7 @@
 	parts = GAIM_PLUGIN_PROTOCOL_INFO(chat->account->gc->prpl)->chat_info(chat->account->gc);
 	pce = parts->data;
 	ret = g_hash_table_lookup(chat->components, pce->identifier);
-	for (tmp = parts; tmp; tmp = tmp->next)
-		g_free(tmp->data);
+	g_list_foreach(parts, (GFunc)g_free, NULL);
 	g_list_free(parts);
 
 	return ret;
--- a/src/buddyicon.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/buddyicon.c	Sat Aug 05 08:27:39 2006 +0000
@@ -312,7 +312,6 @@
 	g_return_if_fail(username != NULL);
 
 	g_free(icon->username);
-
 	icon->username = g_strdup(username);
 }
 
@@ -480,7 +479,6 @@
 	g_return_if_fail(dir != NULL);
 
 	g_free(cache_dir);
-
 	cache_dir = g_strdup(dir);
 }
 
--- a/src/cipher.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/cipher.c	Sat Aug 05 08:27:39 2006 +0000
@@ -10,7 +10,7 @@
  *
  * Original md4 taken from linux kernel
  * MD4 Message Digest Algorithm (RFC1320).
- * 
+ *
  * Implementation derived from Andrew Tridgell and Steve French's
  * CIFS MD4 implementation, and the cryptoapi implementation
  * originally based on the public domain implementation written
@@ -26,16 +26,16 @@
  *
  * des.c - DES and Triple-DES encryption/decryption Algorithm
  *	Copyright (C) 1998 Free Software Foundation, Inc.
- *	
+ *
  *	Please see below for more legal information!
- *	
+ *
  *	 According to the definition of DES in FIPS PUB 46-2 from December 1993.
  *	 For a description of triple encryption, see:
  *	   Bruce Schneier: Applied Cryptography. Second Edition.
  *	   John Wiley & Sons, 1996. ISBN 0-471-12845-7. Pages 358 ff.
- *	
+ *
  *	 This file is part of GnuPG.
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
--- a/src/cmds.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/cmds.c	Sat Aug 05 08:27:39 2006 +0000
@@ -71,9 +71,9 @@
 	c->args = g_strdup(args);
 	c->priority = p;
 	c->flags = f;
-	c->prpl_id = prpl_id ? g_strdup(prpl_id) : NULL;
+	c->prpl_id = g_strdup(prpl_id);
 	c->func = func;
-	c->help = helpstr ? g_strdup(helpstr) : NULL;
+	c->help = g_strdup(helpstr);
 	c->data = data;
 
 	cmds = g_list_insert_sorted(cmds, c, (GCompareFunc)cmds_compare_func);
@@ -85,11 +85,8 @@
 {
 	g_free(c->cmd);
 	g_free(c->args);
-	if (c->prpl_id)
-		g_free(c->prpl_id);
-	if (c->help)
-		g_free(c->help);
-
+	g_free(c->prpl_id);
+	g_free(c->help);
 	g_free(c);
 }
 
@@ -109,6 +106,10 @@
 	}
 }
 
+/**
+ * This sets args to a NULL-terminated array of strings.  It should
+ * be freed using g_strfreev().
+ */
 static gboolean gaim_cmd_parse_args(GaimCmd *cmd, const gchar *s, const gchar *m, gchar ***args)
 {
 	int i;
@@ -142,7 +143,7 @@
 			  (*args)[i] = gaim_markup_slice(m, g_utf8_pointer_to_offset(s, cur), g_utf8_pointer_to_offset(s, end));
 			  cur = end +1;
 			}
-			break; 
+			break;
 		case 's':
 			(*args)[i] = g_strdup(cur);
 			cur = cur + strlen(cur);
@@ -160,15 +161,6 @@
 	return TRUE;
 }
 
-static void gaim_cmd_free_args(gchar **args)
-{
-	int i;
-
-	for (i = 0; args[i]; i++)
-		g_free(args[i]);
-	g_free(args);
-}
-
 static void gaim_cmd_strip_current_char(gunichar c, char *s, guint len)
 {
 	int bytes;
@@ -260,7 +252,7 @@
 
 		/* this checks the allow bad args flag for us */
 		if (!gaim_cmd_parse_args(c, rest, mrest, &args)) {
-			gaim_cmd_free_args(args);
+			g_strfreev(args);
 			args = NULL;
 			continue;
 		}
@@ -268,10 +260,9 @@
 		tried_cmd = TRUE;
 		ret = c->func(conv, cmd, args, &err, c->data);
 		if (ret == GAIM_CMD_RET_CONTINUE) {
-			if (err)
-				g_free(err);
+			g_free(err);
 			err = NULL;
-			gaim_cmd_free_args(args);
+			g_strfreev(args);
 			args = NULL;
 			continue;
 		} else {
@@ -280,8 +271,7 @@
 
 	}
 
-	if (args)
-		gaim_cmd_free_args(args);
+	g_strfreev(args);
 	g_free(cmd);
 	g_free(mrest);
 
--- a/src/connection.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/connection.c	Sat Aug 05 08:27:39 2006 +0000
@@ -337,10 +337,8 @@
 {
 	g_return_if_fail(gc != NULL);
 
-	if (gc->display_name != NULL)
-		g_free(gc->display_name);
-
-	gc->display_name = (name == NULL ? NULL : g_strdup(name));
+	g_free(gc->display_name);
+	gc->display_name = g_strdup(name);
 }
 
 GaimConnectionState
--- a/src/conversation.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/conversation.c	Sat Aug 05 08:27:39 2006 +0000
@@ -335,7 +335,6 @@
 	GaimConversationUiOps *ops;
 	GaimConnection *gc;
 	const char *name;
-	GList *node;
 
 	g_return_if_fail(conv != NULL);
 
@@ -433,34 +432,22 @@
 	}
 	else if (conv->type == GAIM_CONV_TYPE_CHAT) {
 
-		for (node = conv->u.chat->in_room; node != NULL; node = node->next) {
-			if (node->data != NULL)
-				gaim_conv_chat_cb_destroy((GaimConvChatBuddy *)node->data);
-			node->data = NULL;
-		}
-
-		for (node = conv->u.chat->ignored; node != NULL; node = node->next) {
-			if (node->data != NULL)
-				g_free(node->data);
-			node->data = NULL;
-		}
-
+		g_list_foreach(conv->u.chat->in_room, (GFunc)gaim_conv_chat_cb_destroy, NULL);
 		g_list_free(conv->u.chat->in_room);
+
+		g_list_foreach(conv->u.chat->ignored, (GFunc)g_free, NULL);
 		g_list_free(conv->u.chat->ignored);
 
 		conv->u.chat->in_room = NULL;
 		conv->u.chat->ignored = NULL;
 
-		if (conv->u.chat->who != NULL)
-			g_free(conv->u.chat->who);
+		g_free(conv->u.chat->who);
 		conv->u.chat->who = NULL;
 
-		if (conv->u.chat->topic != NULL)
-			g_free(conv->u.chat->topic);
+		g_free(conv->u.chat->topic);
 		conv->u.chat->topic = NULL;
 
-		if(conv->u.chat->nick)
-			g_free(conv->u.chat->nick);
+		g_free(conv->u.chat->nick);
 
 		GAIM_DBUS_UNREGISTER_POINTER(conv->u.chat);
 		g_free(conv->u.chat);
@@ -587,9 +574,7 @@
 	g_return_if_fail(conv  != NULL);
 	g_return_if_fail(title != NULL);
 
-	if (conv->title != NULL)
-		g_free(conv->title);
-
+	g_free(conv->title);
 	conv->title = g_strdup(title);
 
 	gaim_conversation_update(conv, GAIM_CONV_UPDATE_TITLE);
@@ -651,10 +636,8 @@
 {
 	g_return_if_fail(conv != NULL);
 
-	if (conv->name != NULL)
-		g_free(conv->name);
-
-	conv->name = (name == NULL ? NULL : g_strdup(name));
+	g_free(conv->name);
+	conv->name = g_strdup(name);
 
 	gaim_conversation_autoset_title(conv);
 }
@@ -1326,11 +1309,11 @@
 {
 	g_return_if_fail(chat != NULL);
 
-	if (chat->who   != NULL) g_free(chat->who);
-	if (chat->topic != NULL) g_free(chat->topic);
-
-	chat->who   = (who   == NULL ? NULL : g_strdup(who));
-	chat->topic = (topic == NULL ? NULL : g_strdup(topic));
+	g_free(chat->who);
+	g_free(chat->topic);
+
+	chat->who   = g_strdup(who);
+	chat->topic = g_strdup(topic);
 
 	gaim_conversation_update(gaim_conv_chat_get_conversation(chat),
 							 GAIM_CONV_UPDATE_TOPIC);
@@ -1447,7 +1430,6 @@
 	char *user1 = NULL, *user2 = NULL;
 	gint ret = 0;
 
-	
 	if (a) {
 		f1 = a->flags;
 		if (a->alias_key)
@@ -1455,7 +1437,7 @@
 		else if (a->name)
 			user1 = a->name;
 	}
-	
+
 	if (b) {
 		f2 = b->flags;
 		if (b->alias_key)
@@ -1470,7 +1452,7 @@
 	} else if (f1 != f2) {
 		/* sort more important users first */
 		ret = (f1 > f2) ? -1 : 1;
-	} else if (a->buddy != b->buddy) { 
+	} else if (a->buddy != b->buddy) {
 		ret = a->buddy ? -1 : 1;
 	} else {
 		ret = strcasecmp(user1, user2);
@@ -1565,7 +1547,7 @@
 	}
 
 	cbuddies = g_list_sort(cbuddies, (GCompareFunc)gaim_conv_chat_cb_compare);
-	
+
 	if (ops != NULL && ops->chat_add_users != NULL)
 		ops->chat_add_users(conv, cbuddies, new_arrivals);
 
@@ -1728,7 +1710,7 @@
 		}
 
 		/* NOTE: Don't remove them from ignored in case they re-enter. */
-	
+
 		if (!quiet) {
 			const char *alias = user;
 			char *escaped;
@@ -1866,8 +1848,7 @@
 void gaim_conv_chat_set_nick(GaimConvChat *chat, const char *nick) {
 	g_return_if_fail(chat != NULL);
 
-	if(chat->nick)
-		g_free(chat->nick);
+	g_free(chat->nick);
 	chat->nick = g_strdup(gaim_normalize(chat->conv->account, nick));
 }
 
@@ -1920,10 +1901,7 @@
 	cb = g_new0(GaimConvChatBuddy, 1);
 	cb->name = g_strdup(name);
 	cb->flags = flags;
-	if (alias)
-		cb->alias = g_strdup(alias);
-	else
-		cb->alias = NULL;
+	cb->alias = g_strdup(alias);
 
 	GAIM_DBUS_REGISTER_POINTER(cb, GaimConvChatBuddy);
 	return cb;
@@ -1950,15 +1928,12 @@
 void
 gaim_conv_chat_cb_destroy(GaimConvChatBuddy *cb)
 {
-	g_return_if_fail(cb != NULL);
+	if (cb == NULL)
+		return;
 
 	g_free(cb->alias);
 	g_free(cb->alias_key);
 	g_free(cb->name);
-	cb->name = NULL;
-	cb->alias = NULL;
-	cb->alias_key = NULL;
-	cb->flags = 0;
 
 	GAIM_DBUS_UNREGISTER_POINTER(cb);
 	g_free(cb);
--- a/src/core.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/core.c	Sat Aug 05 08:27:39 2006 +0000
@@ -196,11 +196,7 @@
 	gaim_dbus_uninit();
 #endif
 
-	if (core->ui != NULL) {
-		g_free(core->ui);
-		core->ui = NULL;
-	}
-
+	g_free(core->ui);
 	g_free(core);
 
 	_core = NULL;
--- a/src/dbus-define-api.h	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/dbus-define-api.h	Sat Aug 05 08:27:39 2006 +0000
@@ -7,10 +7,10 @@
 
 /* blist.h */
 gboolean GAIM_BLIST_NODE_IS_CHAT(GaimBlistNode *node);
-gboolean GAIM_BLIST_NODE_IS_BUDDY(GaimBlistNode *node);   
+gboolean GAIM_BLIST_NODE_IS_BUDDY(GaimBlistNode *node);
 gboolean GAIM_BLIST_NODE_IS_CONTACT(GaimBlistNode *node);
 gboolean GAIM_BLIST_NODE_IS_GROUP(GaimBlistNode *node);
-gboolean GAIM_BUDDY_IS_ONLINE(GaimBuddy *buddy); 
+gboolean GAIM_BUDDY_IS_ONLINE(GaimBuddy *buddy);
 gboolean GAIM_BLIST_NODE_HAS_FLAG(GaimBlistNode *node, int flags);
 gboolean GAIM_BLIST_NODE_SHOULD_SAVE(GaimBlistNode *node);
 
--- a/src/dbus-server.h	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/dbus-server.h	Sat Aug 05 08:27:39 2006 +0000
@@ -32,7 +32,7 @@
 
 G_BEGIN_DECLS
 
-/** 
+/**
    Types of pointers are identified by the ADDRESS of a GaimDbusType
    object.  This way, plugins can easily access types defined in gaim
    proper as well as introduce their own types that will not conflict
@@ -41,7 +41,7 @@
    The structure GaimDbusType has only one element (GaimDBusType::parent), a
    contains a pointer to the parent type, or @c NULL if the type has no
    parent.  Parent means the same as the base class in object oriented
-   programming.  
+   programming.
 */
 
 typedef struct _GaimDBusType GaimDBusType;
@@ -98,7 +98,7 @@
    In order for an object to participate in the scheme, it must
    register itself and its type with the engine.  This registration
    allocates an integer id which can be resolved to the pointer and
-   back.  
+   back.
 
    Handles are not persistent.  They are reissued every time gaim is
    started.  This is not good; external applications that use gaim
@@ -108,14 +108,14 @@
    Pointer registration is only a temporary solution.  When GaimBuddy
    and similar structures have been converted into gobjects, this
    registration will be done automatically by objects themselves.
-   
+
    By the way, this kind of object-handle translation should be so
    common that there must be a library (maybe even glib) that
    implements it.  I feel a bit like reinventing the wheel here.
 */
 void gaim_dbus_init_ids(void);
 
-/** 
+/**
     Registers a typed pointer.
 
     @param node   The pointer to register.
@@ -123,7 +123,7 @@
  */
 void gaim_dbus_register_pointer(gpointer node, GaimDBusType *type);
 
-/** 
+/**
     Unregisters a pointer previously registered with
     gaim_dbus_register_pointer.
 
@@ -142,7 +142,7 @@
                        the types of the parameters.
     @param vargs       A va_list containing the actual parameters.
   */
-void gaim_dbus_signal_emit_gaim(const char *name, int num_values, 
+void gaim_dbus_signal_emit_gaim(const char *name, int num_values,
 				GaimValue **values, va_list vargs);
 
 /**
@@ -191,7 +191,7 @@
 
 #define DBUS_EXPORT
 
-/* 
+/*
    Here we include the list of #GAIM_DBUS_DECLARE_TYPE statements for
    all structs defined in gaim.  This file has been generated by the
    #dbus-analize-types.py script.
--- a/src/dbus-useful.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/dbus-useful.c	Sat Aug 05 08:27:39 2006 +0000
@@ -7,47 +7,47 @@
 
 
 GaimAccount *
-gaim_accounts_find_ext(const char *name, const char *protocol_id, 
+gaim_accounts_find_ext(const char *name, const char *protocol_id,
 		       gboolean (*account_test)(const GaimAccount *account))
 {
-    GaimAccount *result = NULL;
-    GList *l;
-    char *who;
-    
-    if (name)
-	who = g_strdup(gaim_normalize(NULL, name));
-    else 
-	who = NULL;
-    
-    for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
-	GaimAccount *account = (GaimAccount *)l->data;
-	
-	if (who && strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who))
-	    continue;
+	GaimAccount *result = NULL;
+	GList *l;
+	char *who;
+
+	if (name)
+		who = g_strdup(gaim_normalize(NULL, name));
+	else
+		who = NULL;
+
+	for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
+		GaimAccount *account = (GaimAccount *)l->data;
 
-	if (protocol_id && strcmp(account->protocol_id, protocol_id))
-	    continue;
+		if (who && strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who))
+			continue;
 
-	if (account_test && !account_test(account)) 
-	    continue;
+		if (protocol_id && strcmp(account->protocol_id, protocol_id))
+			continue;
 
-	result = account;
-	break;
-    }
+		if (account_test && !account_test(account))
+			continue;
 
-    g_free(who);
+		result = account;
+		break;
+	}
 
-    return result;
+	g_free(who);
+
+	return result;
 }
 
-GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol) 
+GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol)
 {
-    return gaim_accounts_find_ext(name, protocol, NULL);
+	return gaim_accounts_find_ext(name, protocol, NULL);
 }
 
-GaimAccount *gaim_accounts_find_connected(const char *name, const char *protocol) 
+GaimAccount *gaim_accounts_find_connected(const char *name, const char *protocol)
 {
-    return gaim_accounts_find_ext(name, protocol, gaim_account_is_connected);
+	return gaim_accounts_find_ext(name, protocol, gaim_account_is_connected);
 }
 
 
--- a/src/dbus-useful.h	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/dbus-useful.h	Sat Aug 05 08:27:39 2006 +0000
@@ -1,6 +1,6 @@
 #include "conversation.h"
 
-GaimAccount *gaim_accounts_find_ext(const char *name, const char *protocol_id, 
+GaimAccount *gaim_accounts_find_ext(const char *name, const char *protocol_id,
 				    gboolean (*account_test)(const GaimAccount *account));
 
 GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol);
--- a/src/ft.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/ft.c	Sat Aug 05 08:27:39 2006 +0000
@@ -648,11 +648,7 @@
 	g_return_if_fail(xfer != NULL);
 
 	g_free(xfer->message);
-
-	if (message != NULL)
-		xfer->message = g_strdup(message);
-	else
-		xfer->message = NULL;
+	xfer->message = g_strdup(message);
 }
 
 void
@@ -660,10 +656,8 @@
 {
 	g_return_if_fail(xfer != NULL);
 
-	if (xfer->filename != NULL)
-		g_free(xfer->filename);
-
-	xfer->filename = (filename == NULL ? NULL : g_strdup(filename));
+	g_free(xfer->filename);
+	xfer->filename = g_strdup(filename);
 }
 
 void
@@ -671,10 +665,8 @@
 {
 	g_return_if_fail(xfer != NULL);
 
-	if (xfer->local_filename != NULL)
-		g_free(xfer->local_filename);
-
-	xfer->local_filename = (filename == NULL ? NULL : g_strdup(filename));
+	g_free(xfer->local_filename);
+	xfer->local_filename = g_strdup(filename);
 }
 
 void
--- a/src/gaim-client-example.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gaim-client-example.c	Sat Aug 05 08:27:39 2006 +0000
@@ -5,7 +5,7 @@
 
 #include "gaim-client.h"
 
-/* 
+/*
    This example demonstrates how to use libgaim-client to communicate
    with gaim.  The names and signatures of functions provided by
    libgaim-client are the same as those in gaim.  However, all
@@ -21,19 +21,19 @@
 
 int main (int argc, char **argv)
 {
-    GList *alist, *node;
+	GList *alist, *node;
+
+	gaim_init();
 
-    gaim_init();
-    
-    alist = gaim_accounts_get_all();
-    for (node = alist; node; node = node->next) {
-	GaimAccount *account = (GaimAccount*) node->data;
-	char *name = gaim_account_get_username(account);
-	g_print("Name: %s\n", name);
-	g_free(name);
-    }
+	alist = gaim_accounts_get_all();
+	for (node = alist; node != NULL; node = node->next)
+	{
+		GaimAccount *account = (GaimAccount*) node->data;
+		char *name = gaim_account_get_username(account);
+		g_print("Name: %s\n", name);
+		g_free(name);
+	}
+	g_list_free(alist);
 
-    g_list_free(alist);
-
-    return 0;
+	return 0;
 }
--- a/src/gaim-client.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gaim-client.c	Sat Aug 05 08:27:39 2006 +0000
@@ -10,69 +10,72 @@
 static DBusGConnection *bus;
 static DBusGProxy *gaim_proxy;
 
-static GList *garray_int_to_glist(GArray *array) {
-    GList *list = NULL;
-    int i;
+static GList *garray_int_to_glist(GArray *array)
+{
+	GList *list = NULL;
+	int i;
 
-    for(i = 0; i < array->len; i++) 
-	list = g_list_append(list, GINT_TO_POINTER(g_array_index(array,gint,i)));
+	for (i = 0; i < array->len; i++)
+		list = g_list_append(list, GINT_TO_POINTER(g_array_index(array,gint,i)));
 
-    g_array_free(array, TRUE);
-    return list;
+	g_array_free(array, TRUE);
+	return list;
 }
 
-static GSList *garray_int_to_gslist(GArray *array) {
-    GSList *list = NULL;
-    int i;
+static GSList *garray_int_to_gslist(GArray *array)
+{
+	GSList *list = NULL;
+	int i;
 
-    for(i = 0; i < array->len; i++) 
-	list = g_slist_append(list, GINT_TO_POINTER(g_array_index(array,gint,i)));
+	for (i = 0; i < array->len; i++)
+		list = g_slist_append(list, GINT_TO_POINTER(g_array_index(array,gint,i)));
 
-    g_array_free(array, TRUE);
-    return list;
+	g_array_free(array, TRUE);
+	return list;
 }
 
 #include "gaim-client-bindings.c"
 
-static void lose (const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2);
-static void lose_gerror (const char *prefix, GError *error) G_GNUC_NORETURN;
+static void lose(const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2);
+static void lose_gerror(const char *prefix, GError *error) G_GNUC_NORETURN;
 
 static void
-lose (const char *str, ...)
+lose(const char *str, ...)
 {
-  va_list args;
+	va_list args;
 
-  va_start (args, str);
+	va_start(args, str);
 
-  vfprintf (stderr, str, args);
-  fputc ('\n', stderr);
+	vfprintf(stderr, str, args);
+	fputc('\n', stderr);
 
-  va_end (args);
+	va_end(args);
 
-  exit (1);
+	exit(1);
 }
 
 static void
-lose_gerror (const char *prefix, GError *error) 
+lose_gerror(const char *prefix, GError *error)
 {
-  lose ("%s: %s", prefix, error->message);
+	lose("%s: %s", prefix, error->message);
 }
 
-void gaim_init(void) {
-  GError *error = NULL;
+void gaim_init(void)
+{
+	GError *error = NULL;
 
-  g_type_init ();
+	g_type_init ();
 
-  bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
-  if (!bus) 
-    lose_gerror ("Couldn't connect to session bus", error);
+	bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if (!bus)
+		lose_gerror ("Couldn't connect to session bus", error);
 
-  gaim_proxy = dbus_g_proxy_new_for_name (bus,
-				    DBUS_SERVICE_GAIM,
-				    DBUS_PATH_GAIM,         
-				    DBUS_INTERFACE_GAIM);
+	gaim_proxy = dbus_g_proxy_new_for_name (bus,
+					DBUS_SERVICE_GAIM,
+					DBUS_PATH_GAIM,
+					DBUS_INTERFACE_GAIM);
 
-  if (!gaim_proxy)
-    lose_gerror ("Couldn't connect to the Gaim Service", error);
+	if (!gaim_proxy)
+		lose_gerror ("Couldn't connect to the Gaim Service", error);
 }
 
--- a/src/gtkaccount.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkaccount.c	Sat Aug 05 08:27:39 2006 +0000
@@ -204,7 +204,7 @@
 		gaim_gtk_buddy_icon_get_scale_size(pixbuf,
 							&dialog->prpl_info->icon_spec, &width, &height);
 		scale = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR);
-		
+
 		g_object_unref(G_OBJECT(pixbuf));
 		pixbuf = scale;
 	}
@@ -231,9 +231,7 @@
 	{
 		dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin);
 
-		if (dialog->protocol_id != NULL)
-			g_free(dialog->protocol_id);
-
+		g_free(dialog->protocol_id);
 		dialog->protocol_id = g_strdup(dialog->plugin->info->id);
 	}
 
@@ -317,8 +315,7 @@
 
 #endif /* FILECHOOSER */
 
-	if (dialog->icon_path)
-		g_free(dialog->icon_path);
+	g_free(dialog->icon_path);
 	dialog->icon_path = convert_buddy_icon(dialog->plugin, filename);
 	set_dialog_icon(dialog);
 	gtk_widget_show(dialog->icon_entry);
@@ -482,8 +479,7 @@
 static void
 icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog)
 {
-	if (dialog->icon_path)
-		g_free(dialog->icon_path);
+	g_free(dialog->icon_path);
 	dialog->icon_path = NULL;
 
 	gtk_widget_hide(dialog->icon_entry);
@@ -512,8 +508,7 @@
 			}
 			if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n')))
 				*rtmp = '\0';
-			if (dialog->icon_path)
-				g_free(dialog->icon_path);
+			g_free(dialog->icon_path);
 			dialog->icon_path = convert_buddy_icon(dialog->plugin, tmp);
 			set_dialog_icon(dialog);
 			gtk_widget_show(dialog->icon_entry);
@@ -1423,14 +1418,9 @@
 
 	gtk_widget_destroy(dialog->window);
 
-	if (dialog->user_split_entries != NULL)
-		g_list_free(dialog->user_split_entries);
-
-	if (dialog->protocol_opt_entries != NULL)
-		g_list_free(dialog->protocol_opt_entries);
-
-	if (dialog->protocol_id != NULL)
-		g_free(dialog->protocol_id);
+	g_list_free(dialog->user_split_entries);
+	g_list_free(dialog->protocol_opt_entries);
+	g_free(dialog->protocol_id);
 
 	if (dialog->icon_path != NULL)
 	{
@@ -2572,10 +2562,7 @@
 free_add_user_data(GaimGtkAccountAddUserData *data)
 {
 	g_free(data->username);
-
-	if (data->alias != NULL)
-		g_free(data->alias);
-
+	g_free(data->alias);
 	g_free(data);
 }
 
@@ -2645,7 +2632,7 @@
 	data = g_new0(GaimGtkAccountAddUserData, 1);
 	data->account  = account;
 	data->username = g_strdup(remote_user);
-	data->alias    = (alias != NULL ? g_strdup(alias) : NULL);
+	data->alias    = g_strdup(alias);
 
 	buffer = make_info(account, gc, remote_user, id, alias, msg);
 
--- a/src/gtkblist.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkblist.c	Sat Aug 05 08:27:39 2006 +0000
@@ -553,9 +553,7 @@
 			((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
 	}
 
-	if (data->entries != NULL)
-		g_list_free(data->entries);
-
+	g_list_free(data->entries);
 	data->entries = NULL;
 
 	if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
@@ -1519,8 +1517,7 @@
 	if (aims == NULL && icqs == NULL && yahoos == NULL &&
 		msns == NULL && jabbers == NULL)
 	{
-		if (alias != NULL)
-			g_free(alias);
+		g_free(alias);
 
 		return FALSE;
 	}
@@ -1531,8 +1528,7 @@
 	add_buddies_from_vcard("prpl-msn",    group, msns,    alias);
 	add_buddies_from_vcard("prpl-jabber", group, jabbers, alias);
 
-	if (alias != NULL)
-		g_free(alias);
+	g_free(alias);
 
 	return TRUE;
 }
@@ -1594,7 +1590,6 @@
 		GValue val;
 		GString *str;
 		const char *protocol;
-		char *mime_str;
 
 		ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row");
 		sourcerow = gtk_tree_row_reference_get_path(ref);
@@ -1654,15 +1649,13 @@
 
 		str = g_string_append(str, "\r\n");
 
-		mime_str = g_string_free(str, FALSE);
-
 		gtk_selection_data_set(data,
 					gdk_atom_intern("application/x-im-contact", FALSE),
 					8, /* bits */
-					(const guchar *)mime_str,
-					strlen(mime_str) + 1);
-
-		g_free(mime_str);
+					(const guchar *)str->str,
+					strlen(str->str) + 1);
+
+		g_string_free(str, TRUE);
 		gtk_tree_path_free(sourcerow);
 	}
 }
@@ -1878,9 +1871,9 @@
 			}
 		}
 
-		if (username != NULL) g_free(username);
-		if (protocol != NULL) g_free(protocol);
-		if (alias    != NULL) g_free(alias);
+		g_free(username);
+		g_free(protocol);
+		g_free(alias);
 
 		if (path != NULL)
 			gtk_tree_path_free(path);
@@ -2966,7 +2959,7 @@
 		statustext = g_strdup(_("Offline"));
 	else if (!statustext)
 		text = g_strdup(esc);
-		
+
 	if (gaim_presence_is_idle(presence)) {
 		if (gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time")) {
 			time_t idle_secs = gaim_presence_get_idle_time(presence);
@@ -3017,7 +3010,7 @@
 	}
 
 	/* It is selected. */
-	if ((selected && !text) || (selected && idletime)) 
+	if ((selected && !text) || (selected && idletime))
 		text = g_strdup_printf("%s\n"
 			"<span size='smaller'>%s%s%s</span>",
 			esc,
@@ -3072,7 +3065,7 @@
 
 	if (gtk_blist_obscured || !GTK_WIDGET_VISIBLE(gtkblist->window))
 		return TRUE;
-	
+
 	for(gnode = list->root; gnode; gnode = gnode->next) {
 		if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
 			continue;
@@ -3084,7 +3077,7 @@
 
 				if (buddy &&
 						gaim_presence_is_idle(gaim_buddy_get_presence(buddy)))
-					gaim_gtk_blist_update_contact(list, (GaimBlistNode*)buddy);		
+					gaim_gtk_blist_update_contact(list, (GaimBlistNode*)buddy);
 			}
 		}
 	}
@@ -4246,7 +4239,7 @@
 
 	contact = (GaimContact*)cnode;
 	buddy = gaim_contact_get_priority_buddy(contact);
-	
+
 	if (buddy_is_displayable(buddy))
 	{
 		GtkTreeIter iter;
@@ -4294,10 +4287,10 @@
 	g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
 
 	if (node->parent == NULL)
-		return;	
+		return;
 
 	buddy = (GaimBuddy*)node;
-	
+
 	/* First things first, update the contact */
 	gaim_gtk_blist_update_contact(list, node);
 
@@ -4800,8 +4793,7 @@
 			((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
 	}
 
-	if (data->entries != NULL)
-		g_list_free(data->entries);
+	g_list_free(data->entries);
 
 	data->entries = NULL;
 
@@ -5833,7 +5825,7 @@
 		submenu = gtk_menu_new();
 		gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
 		gtk_widget_show(submenu);
-		
+
 		gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group);
 		path = g_strdup_printf("%s/Tools/%s", gtkblist->ift->path, plugin->info->name);
 		gtk_menu_set_accel_path(GTK_MENU(submenu), path);
--- a/src/gtkconv.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkconv.c	Sat Aug 05 08:27:39 2006 +0000
@@ -193,15 +193,9 @@
 static gint
 close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
 {
-	GList *list = g_list_copy(gtkconv->convs), *l;
-
-	l = list;
-	while (l) {
-		GaimConversation *conv = l->data;
-		gaim_conversation_destroy(conv);
-		l = l->next;
-	}
-
+	GList *list = g_list_copy(gtkconv->convs);
+
+	g_list_foreach(list, (GFunc)gaim_conversation_destroy, NULL);
 	g_list_free(list);
 
 	return TRUE;
@@ -489,8 +483,7 @@
 			case GAIM_CMD_STATUS_FAILED:
 				gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."),
 						GAIM_MESSAGE_NO_LOG, time(NULL));
-				if(error)
-					g_free(error);
+				g_free(error);
 				return TRUE;
 			case GAIM_CMD_STATUS_WRONG_TYPE:
 				if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
@@ -771,8 +764,8 @@
 			}
 		}
 
-		if (username != NULL) g_free(username);
-		if (protocol != NULL) g_free(protocol);
+		g_free(username);
+		g_free(protocol);
 
 		gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
 	}
@@ -1426,7 +1419,7 @@
 		gaim_conv_chat_ignore(chat, name);
 
 	cbuddy = gaim_conv_chat_cb_new(name, alias, flags);
-	
+
 	add_chat_buddy_common(conv, cbuddy, NULL);
 	g_free(name);
 	g_free(alias);
@@ -1525,7 +1518,7 @@
 
 	who = g_object_get_data(G_OBJECT(w), "user_data");
 	mark = get_mark_for_user(gtkconv, who);
-	
+
 	if (mark != NULL)
 		gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0);
 	else
@@ -3214,8 +3207,7 @@
 	GaimBlistNode *gnode,*cnode,*bnode;
 	static GList *tmp = NULL;
 
-	if (tmp)
-		g_list_free(tmp);
+	g_list_free(tmp);
 
 	tmp = g_list_append(NULL, "");
 
@@ -4261,8 +4253,8 @@
 			}
 		}
 
-		if (username != NULL) g_free(username);
-		if (protocol != NULL) g_free(protocol);
+		g_free(username);
+		g_free(protocol);
 
 		gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
 	}
@@ -4868,8 +4860,7 @@
 			}
 		}
 
-		if(alias_escaped)
-			g_free(alias_escaped);
+		g_free(alias_escaped);
 
 		/* Are we in a chat where we can tell which users are buddies? */
 		if  (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) &&
@@ -5070,7 +5061,7 @@
 	g_return_if_fail(new_alias != NULL);
 
 	cbuddy = gaim_conv_chat_cb_new(new_name, new_alias, flags);
-	
+
 	add_chat_buddy_common(conv, cbuddy, old_name);
 }
 
@@ -5177,7 +5168,7 @@
 	flags = gaim_conv_chat_user_get_flags(chat, user);
 
 	cbuddy = gaim_conv_chat_cb_new(user, alias, flags);
-	
+
 	add_chat_buddy_common(conv, cbuddy, NULL);
 	g_free(alias);
 }
--- a/src/gtkdebug.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkdebug.c	Sat Aug 05 08:27:39 2006 +0000
@@ -58,9 +58,9 @@
 
 	gboolean invert;
 	gboolean highlight;
-	
+
 	guint timer;
-	
+
 	regex_t regex;
 #else
 	GtkWidget *find;
@@ -351,8 +351,8 @@
 
 			for(m = 0; m < n_matches; m++) {
 				GtkTextIter ms, me;
-				
-				if(matches[m].rm_eo == -1) 
+
+				if(matches[m].rm_eo == -1)
 					break;
 
 				i += offset;
@@ -524,7 +524,7 @@
 	 */
 	if(win->paused)
 		return;
-	
+
 	gtk_tree_model_get(model, iter, 0, &text, -1);
 
 	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) {
@@ -840,8 +840,7 @@
 		g_free(new_msg);
 	}
 
-	if (new_domain != NULL)
-		g_free(new_domain);
+	g_free(new_domain);
 }
 
 #ifdef _WIN32
--- a/src/gtkft.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkft.c	Sat Aug 05 08:27:39 2006 +0000
@@ -1097,8 +1097,7 @@
 
 	data = GAIM_GTKXFER(xfer);
 	if (data) {
-		if (data->name)
-			g_free(data->name);
+		g_free(data->name);
 		g_free(data);
 		xfer->ui_data = NULL;
 	}
--- a/src/gtkimhtml.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkimhtml.c	Sat Aug 05 08:27:39 2006 +0000
@@ -1248,10 +1248,8 @@
 
 	g_list_free(imhtml->scalables);
 	g_slist_free(imhtml->im_images);
-	if (imhtml->protocol_name)
-		g_free(imhtml->protocol_name);
-	if (imhtml->search_string)
-		g_free(imhtml->search_string);
+	g_free(imhtml->protocol_name);
+	g_free(imhtml->search_string);
 	G_OBJECT_CLASS(parent_class)->finalize (object);
 }
 
@@ -2737,8 +2735,7 @@
 							gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos);
 							ws[0] = '\0'; wpos = 0;
 							/* NEW_BIT(NEW_TEXT_BIT); */
-							if (bg)
-								g_free(bg);
+							g_free(bg);
 							bg = bgcolor;
 							gtk_imhtml_toggle_background(imhtml, bg);
 						}
@@ -2752,8 +2749,7 @@
 							ws[0] = '\0'; wpos = 0;
 							gtk_imhtml_toggle_link(imhtml, href);
 						}
-						if (href)
-							g_free(href);
+						g_free(href);
 					}
 					break;
 				case 46:	/* IMG (opt) */
@@ -3037,14 +3033,10 @@
 	while (fonts) {
 		GtkIMHtmlFontDetail *font = fonts->data;
 		fonts = g_slist_remove (fonts, font);
-		if (font->face)
-			g_free (font->face);
-		if (font->fore)
-			g_free (font->fore);
-		if (font->back)
-			g_free (font->back);
-		if (font->sml)
-			g_free (font->sml);
+		g_free (font->face);
+		g_free (font->fore);
+		g_free (font->back);
+		g_free (font->sml);
 		g_free (font);
 	}
 
@@ -3082,9 +3074,8 @@
 
 void
 gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name) {
-	if (imhtml->protocol_name)
-		g_free(imhtml->protocol_name);
-	imhtml->protocol_name = protocol_name ? g_strdup(protocol_name) : NULL;
+	g_free(imhtml->protocol_name);
+	imhtml->protocol_name = g_strdup(protocol_name);
 }
 
 void
@@ -3174,7 +3165,7 @@
 	im_image->width = gdk_pixbuf_get_width(img);
 	im_image->height = gdk_pixbuf_get_height(img);
 	im_image->mark = NULL;
-	im_image->filename = filename ? g_strdup(filename) : NULL;
+	im_image->filename = g_strdup(filename);
 	im_image->id = id;
 	im_image->filesel = NULL;
 
@@ -3441,8 +3432,7 @@
 	GtkIMHtmlImage *image = (GtkIMHtmlImage *)scale;
 
 	g_object_unref(image->pixbuf);
-	if (image->filename)
-		g_free(image->filename);
+	g_free(image->filename);
 	if (image->filesel)
 		gtk_widget_destroy(image->filesel);
 	g_free(scale);
@@ -3559,8 +3549,7 @@
 	gtk_text_buffer_get_end_iter(imhtml->text_buffer, &end);
 
 	gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "search", &start, &end);
-	if (imhtml->search_string)
-		g_free(imhtml->search_string);
+	g_free(imhtml->search_string);
 	imhtml->search_string = NULL;
 }
 
@@ -3825,7 +3814,7 @@
 					strncmp(tag->name, "LINK ", 5) == 0 && imhtml->edit.link) {
 				gtk_imhtml_toggle_link(imhtml, NULL);
 			}
-		}			
+		}
 	}
 	g_slist_free(tags);
 }
@@ -3944,37 +3933,25 @@
 char *
 gtk_imhtml_get_current_fontface(GtkIMHtml *imhtml)
 {
-	if (imhtml->edit.fontface)
-		return g_strdup(imhtml->edit.fontface);
-	else
-		return NULL;
+	return g_strdup(imhtml->edit.fontface);
 }
 
 char *
 gtk_imhtml_get_current_forecolor(GtkIMHtml *imhtml)
 {
-	if (imhtml->edit.forecolor)
-		return g_strdup(imhtml->edit.forecolor);
-	else
-		return NULL;
+	return g_strdup(imhtml->edit.forecolor);
 }
 
 char *
 gtk_imhtml_get_current_backcolor(GtkIMHtml *imhtml)
 {
-	if (imhtml->edit.backcolor)
-		return g_strdup(imhtml->edit.backcolor);
-	else
-		return NULL;
+	return g_strdup(imhtml->edit.backcolor);
 }
 
 char *
 gtk_imhtml_get_current_background(GtkIMHtml *imhtml)
 {
-	if (imhtml->edit.background)
-		return g_strdup(imhtml->edit.background);
-	else
-		return NULL;
+	return g_strdup(imhtml->edit.background);
 }
 
 gint
@@ -4029,15 +4006,15 @@
 		return;
 
 	imhtml->edit.bold = imhtml->edit.italic = imhtml->edit.underline = imhtml->edit.strike = FALSE;
-	if (imhtml->edit.forecolor)
-		g_free(imhtml->edit.forecolor);
+	g_free(imhtml->edit.forecolor);
 	imhtml->edit.forecolor = NULL;
-	if (imhtml->edit.backcolor)
-		g_free(imhtml->edit.backcolor);
+
+	g_free(imhtml->edit.backcolor);
 	imhtml->edit.backcolor = NULL;
-	if (imhtml->edit.fontface)
-		g_free(imhtml->edit.fontface);
+
+	g_free(imhtml->edit.fontface);
 	imhtml->edit.fontface = NULL;
+
 	imhtml->edit.fontsize = 0;
 	imhtml->edit.link = NULL;
 
--- a/src/gtkimhtmltoolbar.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkimhtmltoolbar.c	Sat Aug 05 08:27:39 2006 +0000
@@ -878,8 +878,7 @@
 				toolbar);
 	}
 
-	if (toolbar->sml)
-		free(toolbar->sml);
+	free(toolbar->sml);
 	gtk_object_sink(GTK_OBJECT(toolbar->tooltips));
 
 	G_OBJECT_CLASS(parent_class)->finalize (object);
@@ -1132,8 +1131,6 @@
 
 void gtk_imhtmltoolbar_associate_smileys(GtkIMHtmlToolbar *toolbar, const char *proto_id)
 {
-	if (toolbar->sml)
-		g_free(toolbar->sml);
-
+	g_free(toolbar->sml);
 	toolbar->sml = g_strdup(proto_id);
 }
--- a/src/gtklog.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtklog.c	Sat Aug 05 08:27:39 2006 +0000
@@ -111,8 +111,7 @@
 	const char *search_term = gtk_entry_get_text(GTK_ENTRY(lv->entry));
 	GList *logs;
 
-	if (lv->search != NULL)
-		g_free(lv->search);
+	g_free(lv->search);
 
 	gtk_tree_store_clear(lv->treestore);
 	if (!(*search_term)) {
@@ -154,9 +153,7 @@
 		lv = g_hash_table_lookup(log_viewers, ht);
 		g_hash_table_remove(log_viewers, ht);
 
-		if (ht->screenname != NULL)
-			g_free(ht->screenname);
-
+		g_free(ht->screenname);
 		g_free(ht);
 	} else
 		syslog_viewer = NULL;
@@ -164,10 +161,9 @@
 	g_list_foreach(lv->logs, (GFunc)gaim_log_free, NULL);
 	g_list_free(lv->logs);
 
-	if (lv->search != NULL)
-		g_free(lv->search);
+	g_free(lv->search);
+	g_free(lv);
 
-	g_free(lv);
 	gtk_widget_destroy(w);
 
 	return TRUE;
--- a/src/gtkpluginpref.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkpluginpref.c	Sat Aug 05 08:27:39 2006 +0000
@@ -57,9 +57,6 @@
 	g_return_if_fail(pref);
 
 	text = gtk_imhtml_get_markup(imhtml);
-
-	if (!text)
-		text = "";
 	gaim_prefs_set_string(pref, text);
 	g_free(text);
 }
--- a/src/gtkpounce.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkpounce.c	Sat Aug 05 08:27:39 2006 +0000
@@ -432,8 +432,8 @@
 			}
 		}
 
-		if (username != NULL) g_free(username);
-		if (protocol != NULL) g_free(protocol);
+		g_free(username);
+		g_free(protocol);
 
 		gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
 	}
@@ -1195,7 +1195,7 @@
 	/* Create the scrolled window */
 	sw = gtk_scrolled_window_new(0, 0);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
-			 		GTK_POLICY_AUTOMATIC,
+					GTK_POLICY_AUTOMATIC,
 					GTK_POLICY_AUTOMATIC);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
 						GTK_SHADOW_IN);
--- a/src/gtkprefs.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkprefs.c	Sat Aug 05 08:27:39 2006 +0000
@@ -1474,7 +1474,7 @@
 static gchar* prefs_sound_volume_format(GtkScale *scale, gdouble val)
 {
 	if(val < 15) {
- 		return g_strdup_printf(_("Quietest"));
+		return g_strdup_printf(_("Quietest"));
 	} else if(val < 30) {
 		return g_strdup_printf(_("Quieter"));
 	} else if(val < 45) {
--- a/src/gtkprivacy.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkprivacy.c	Sat Aug 05 08:27:39 2006 +0000
@@ -7,7 +7,7 @@
  * Gaim is the legal property of its developers, whose names are too numerous
  * to list here.  Please refer to the COPYRIGHT file distributed with this
  * source distribution.
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -521,9 +521,7 @@
 static void
 destroy_request_data(GaimGtkPrivacyRequestData *data)
 {
-	if (data->name != NULL)
-		g_free(data->name);
-
+	g_free(data->name);
 	g_free(data);
 }
 
--- a/src/gtkrequest.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkrequest.c	Sat Aug 05 08:27:39 2006 +0000
@@ -364,7 +364,7 @@
 
 	/* Entry field. */
 	data->u.input.multiline = multiline;
-	data->u.input.hint = (hint == NULL ? NULL : g_strdup(hint));
+	data->u.input.hint = g_strdup(hint);
 
 	if ((data->u.input.hint != NULL) && (!strcmp(data->u.input.hint, "html"))) {
 		GtkWidget *frame;
@@ -1586,7 +1586,7 @@
 {
 	GaimGtkRequestData *data;
 	GtkWidget *dirsel;
-	
+
 	data = g_new0(GaimGtkRequestData, 1);
 	data->type = GAIM_REQUEST_FOLDER;
 	data->user_data = user_data;
@@ -1633,8 +1633,7 @@
 {
 	GaimGtkRequestData *data = (GaimGtkRequestData *)ui_handle;
 
-	if (data->cbs != NULL)
-		g_free(data->cbs);
+	g_free(data->cbs);
 
 	gtk_widget_destroy(data->dialog);
 
--- a/src/gtkroomlist.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkroomlist.c	Sat Aug 05 08:27:39 2006 +0000
@@ -593,7 +593,7 @@
 	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
 	g_signal_connect(G_OBJECT(selection), "changed",
 					 G_CALLBACK(selection_changed_cb), grl);
-	
+
 	g_object_unref(model);
 
 	grl->model = model;
--- a/src/gtksound.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtksound.c	Sat Aug 05 08:27:39 2006 +0000
@@ -342,7 +342,7 @@
 static gboolean
 bus_call (GstBus     *bus,
 	  GstMessage *msg,
-  	  gpointer    data)
+	  gpointer    data)
 {
 	GstElement *play = data;
 	GError *err;
@@ -443,17 +443,17 @@
 
 	uri = g_strdup_printf("file://%s", filename);
 	play = gst_element_factory_make("playbin", "play");
-	
+
 	g_object_set(G_OBJECT(play), "uri", uri,
-		                     "volume", volume, 
+		                     "volume", volume,
 		                     "audio-sink", sink, NULL);
 
 	gst_bus_add_watch(gst_pipeline_get_bus(GST_PIPELINE(play)),
 			  bus_call, play);
 	gst_element_set_state(play, GST_STATE_PLAYING);
-	
+
 	g_free(uri);
-	
+
 #else /* USE_GSTREAMER */
 	gdk_beep();
 	return;
@@ -499,7 +499,7 @@
 	if (gaim_prefs_get_bool(enable_pref)) {
 		char *filename = g_strdup(gaim_prefs_get_string(file_pref));
 		if(!filename || !strlen(filename)) {
-			if(filename) g_free(filename);
+			g_free(filename);
 			filename = g_build_filename(DATADIR, "sounds", "gaim", sounds[event].def, NULL);
 		}
 
--- a/src/gtkstatusbox.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkstatusbox.c	Sat Aug 05 08:27:39 2006 +0000
@@ -751,7 +751,7 @@
 			status_menu_refresh_iter(status_box);
 		return TRUE;
 	}
-	
+
 	gtk_gaim_status_box_pulse_typing(status_box);
 	g_source_remove(status_box->typing);
 	status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box);
--- a/src/gtkthemes.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkthemes.c	Sat Aug 05 08:27:39 2006 +0000
@@ -119,23 +119,19 @@
 				theme->list = child;
 			list = child;
 		} else if (!g_ascii_strncasecmp(i, "Name=", strlen("Name="))) {
-			if(theme->name)
-				g_free(theme->name);
+			g_free(theme->name);
 			theme->name = g_strdup(i+ strlen("Name="));
 			theme->name[strlen(theme->name)-1] = 0;
 		} else if (!g_ascii_strncasecmp(i, "Description=", strlen("Description="))) {
-			if(theme->desc)
-				g_free(theme->desc);
+			g_free(theme->desc);
 			theme->desc = g_strdup(i + strlen("Description="));
 			theme->desc[strlen(theme->desc)-1] = 0;
 		} else if (!g_ascii_strncasecmp(i, "Icon=", strlen("Icon="))) {
-			if(theme->icon)
-				g_free(theme->icon);
+			g_free(theme->icon);
 			theme->icon = g_build_filename(dirname, i + strlen("Icon="), NULL);
 			theme->icon[strlen(theme->icon)-1] = 0;
 		} else if (!g_ascii_strncasecmp(i, "Author=", strlen("Author="))) {
-			if(theme->author)
-				g_free(theme->author);
+			g_free(theme->author);
 			theme->author = g_strdup(i + strlen("Author="));
 			theme->author[strlen(theme->author)-1] = 0;
 		} else if (load && list) {
--- a/src/gtkutils.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/gtkutils.c	Sat Aug 05 08:27:39 2006 +0000
@@ -1053,9 +1053,9 @@
 	{
 		valid = FALSE;
 
-		if (username != NULL) g_free(username);
-		if (protocol != NULL) g_free(protocol);
-		if (alias    != NULL) g_free(alias);
+		g_free(username);
+		g_free(protocol);
+		g_free(alias);
 	}
 
 	g_free(str);
--- a/src/imgstore.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/imgstore.c	Sat Aug 05 08:27:39 2006 +0000
@@ -82,10 +82,8 @@
 
 	img = priv->img;
 	if (img) {
-		if (img->data)
-			g_free(img->data);
-		if (img->filename)
-			g_free(img->filename);
+		g_free(img->data);
+		g_free(img->filename);
 		g_free(img);
 	}
 
--- a/src/log.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/log.c	Sat Aug 05 08:27:39 2006 +0000
@@ -110,7 +110,7 @@
 				log->tm->tm_zone = tmp;
 			else
 				/* Just shove the UTF-8 bytes in and hope... */
-				log->tm->tm_zone = (char *)g_strdup(log->tm->tm_zone);
+				log->tm->tm_zone = g_strdup(log->tm->tm_zone);
 		}
 #endif
 	}
@@ -853,7 +853,7 @@
 		for (account_iter = gaim_accounts_get_all() ; account_iter != NULL ; account_iter = account_iter->next) {
 			GaimPlugin *prpl;
 			GaimPluginProtocolInfo *prpl_info;
-		
+
 			prpl = gaim_find_prpl(gaim_account_get_protocol_id((GaimAccount *)account_iter->data));
 			if (!prpl)
 				continue;
@@ -1281,8 +1281,7 @@
 	if (data) {
 		if(data->file)
 			fclose(data->file);
-		if(data->path)
-			g_free(data->path);
+		g_free(data->path);
 
 		g_slice_free(GaimLogCommonLoggerData, data);
 	}
--- a/src/notify.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/notify.c	Sat Aug 05 08:27:39 2006 +0000
@@ -60,9 +60,9 @@
 
 		if (info->ui_handle != NULL) {
 			handles = g_list_append(handles, info);
-			
+
 			return info->ui_handle;
-			
+
 		} else {
 			if (info->cb != NULL)
 				info->cb(info->cb_user_data);
@@ -111,7 +111,7 @@
 			g_free(info);
 
 			return NULL;
-		}		
+		}
 	} else {
 		if (cb != NULL)
 			cb(user_data);
@@ -197,15 +197,15 @@
 
 		if (info->ui_handle != NULL) {
 			handles = g_list_append(handles, info);
-			
+
 			return info->ui_handle;
-			
+
 		} else {
 			if (info->cb != NULL)
 				info->cb(info->cb_user_data);
-			
+
 			g_free(info);
-			
+
 			return NULL;
 		}
 
@@ -272,23 +272,18 @@
 		g_free(button->label);
 		g_free(button);
 	}
-	results->buttons = NULL;
 
 	for (l = results->rows; l; l = g_list_delete_link(l, l)) {
 		GList *row = l->data;
-		for (; row; row = g_list_delete_link(row, row)) {
-			gchar *str = row->data;
-			g_free(str);
-		}
+		g_list_foreach(row, (GFunc)g_free, NULL);
+		g_list_free(row);
 	}
-	results->rows = NULL;
 
 	for (l = results->columns; l; l = g_list_delete_link(l, l)) {
 		GaimNotifySearchColumn *column = l->data;
 		g_free(column->title);
 		g_free(column);
 	}
-	results->columns = NULL;
 
 	g_free(results);
 }
@@ -487,7 +482,7 @@
 
 		if (info->ui_handle != NULL) {
 			handles = g_list_append(handles, info);
-			
+
 			return info->ui_handle;
 
 		} else {
--- a/src/plugin.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/plugin.c	Sat Aug 05 08:27:39 2006 +0000
@@ -190,7 +190,7 @@
 	plugin = g_new0(GaimPlugin, 1);
 
 	plugin->native_plugin = native;
-	plugin->path = (path == NULL ? NULL : g_strdup(path));
+	plugin->path = g_strdup(path);
 
 	GAIM_DBUS_REGISTER_POINTER(plugin, GaimPlugin);
 
@@ -528,8 +528,7 @@
 			                  _("Gaim encountered errors loading the plugin."), tmp);
 			g_free(tmp);
 
-			if (dep_list != NULL)
-				g_list_free(dep_list);
+			g_list_free(dep_list);
 
 			return FALSE;
 		}
@@ -555,8 +554,7 @@
 				                 _("Gaim was unable to load your plugin."), tmp);
 				g_free(tmp);
 
-				if (dep_list != NULL)
-					g_list_free(dep_list);
+				g_list_free(dep_list);
 
 				return FALSE;
 			}
@@ -571,8 +569,7 @@
 		dep_plugin->dependent_plugins = g_list_prepend(dep_plugin->dependent_plugins, plugin->info->id);
 	}
 
-	if (dep_list != NULL)
-		g_list_free(dep_list);
+	g_list_free(dep_list);
 
 	if (plugin->native_plugin)
 	{
@@ -786,7 +783,7 @@
 		return;
 	}
 
-	if (plugin->info != NULL && plugin->info->dependencies != NULL)
+	if (plugin->info != NULL)
 		g_list_free(plugin->info->dependencies);
 
 	if (plugin->native_plugin)
--- a/src/pluginpref.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/pluginpref.c	Sat Aug 05 08:27:39 2006 +0000
@@ -30,11 +30,13 @@
 #include "pluginpref.h"
 #include "prefs.h"
 
-struct _GaimPluginPrefFrame {
+struct _GaimPluginPrefFrame
+{
 	GList *prefs;
 };
 
-struct _GaimPluginPref {
+struct _GaimPluginPref
+{
 	char *name;
 	char *label;
 
@@ -49,7 +51,8 @@
 };
 
 GaimPluginPrefFrame *
-gaim_plugin_pref_frame_new() {
+gaim_plugin_pref_frame_new()
+{
 	GaimPluginPrefFrame *frame;
 
 	frame = g_new0(GaimPluginPrefFrame, 1);
@@ -58,42 +61,36 @@
 }
 
 void
-gaim_plugin_pref_frame_destroy(GaimPluginPrefFrame *frame) {
-	GaimPluginPref *pref;
-	GList *l;
-
-	g_return_if_fail(frame);
+gaim_plugin_pref_frame_destroy(GaimPluginPrefFrame *frame)
+{
+	g_return_if_fail(frame != NULL);
 
-	for(l = frame->prefs; l != NULL; l = l->next) {
-		pref = (GaimPluginPref *)l->data;
-		gaim_plugin_pref_destroy(pref);
-	}
-
+	g_list_foreach(frame->prefs, (GFunc)gaim_plugin_pref_destroy, NULL);
 	g_list_free(frame->prefs);
-	frame->prefs = NULL;
-
 	g_free(frame);
-	frame = NULL;
 }
 
 void
-gaim_plugin_pref_frame_add(GaimPluginPrefFrame *frame, GaimPluginPref *pref) {
-	g_return_if_fail(frame);
-	g_return_if_fail(pref);
+gaim_plugin_pref_frame_add(GaimPluginPrefFrame *frame, GaimPluginPref *pref)
+{
+	g_return_if_fail(frame != NULL);
+	g_return_if_fail(pref  != NULL);
 
 	frame->prefs = g_list_append(frame->prefs, pref);
 }
 
 GList *
-gaim_plugin_pref_frame_get_prefs(GaimPluginPrefFrame *frame) {
-	g_return_val_if_fail(frame, NULL);
-	g_return_val_if_fail(frame->prefs, NULL);
+gaim_plugin_pref_frame_get_prefs(GaimPluginPrefFrame *frame)
+{
+	g_return_val_if_fail(frame        != NULL, NULL);
+	g_return_val_if_fail(frame->prefs != NULL, NULL);
 
 	return frame->prefs;
 }
 
 GaimPluginPref *
-gaim_plugin_pref_new() {
+gaim_plugin_pref_new()
+{
 	GaimPluginPref *pref;
 
 	pref = g_new0(GaimPluginPref, 1);
@@ -102,10 +99,11 @@
 }
 
 GaimPluginPref *
-gaim_plugin_pref_new_with_name(const char *name) {
+gaim_plugin_pref_new_with_name(const char *name)
+{
 	GaimPluginPref *pref;
 
-	g_return_val_if_fail(name, NULL);
+	g_return_val_if_fail(name != NULL, NULL);
 
 	pref = g_new0(GaimPluginPref, 1);
 	pref->name = g_strdup(name);
@@ -114,10 +112,11 @@
 }
 
 GaimPluginPref *
-gaim_plugin_pref_new_with_label(const char *label) {
+gaim_plugin_pref_new_with_label(const char *label)
+{
 	GaimPluginPref *pref;
 
-	g_return_val_if_fail(label, NULL);
+	g_return_val_if_fail(label != NULL, NULL);
 
 	pref = g_new0(GaimPluginPref, 1);
 	pref->label = g_strdup(label);
@@ -126,11 +125,12 @@
 }
 
 GaimPluginPref *
-gaim_plugin_pref_new_with_name_and_label(const char *name, const char *label) {
+gaim_plugin_pref_new_with_name_and_label(const char *name, const char *label)
+{
 	GaimPluginPref *pref;
 
-	g_return_val_if_fail(name, NULL);
-	g_return_val_if_fail(label, NULL);
+	g_return_val_if_fail(name  != NULL, NULL);
+	g_return_val_if_fail(label != NULL, NULL);
 
 	pref = g_new0(GaimPluginPref, 1);
 	pref->name = g_strdup(name);
@@ -140,78 +140,70 @@
 }
 
 void
-gaim_plugin_pref_destroy(GaimPluginPref *pref) {
-	g_return_if_fail(pref);
-
-	if(pref->name) {
-		g_free(pref->name);
-		pref->name = NULL;
-	}
+gaim_plugin_pref_destroy(GaimPluginPref *pref)
+{
+	g_return_if_fail(pref != NULL);
 
-	if(pref->label) {
-		g_free(pref->label);
-		pref->label = NULL;
-	}
-
-	if(pref->choices) {
-		g_list_free(pref->choices);
-		pref->choices = NULL;
-	}
-
+	g_free(pref->name);
+	g_free(pref->label);
+	g_list_free(pref->choices);
 	g_free(pref);
 }
 
 void
-gaim_plugin_pref_set_name(GaimPluginPref *pref, const char *name) {
-	g_return_if_fail(pref);
-	g_return_if_fail(name);
+gaim_plugin_pref_set_name(GaimPluginPref *pref, const char *name)
+{
+	g_return_if_fail(pref != NULL);
+	g_return_if_fail(name != NULL);
 
-	if(pref->name)
-		g_free(pref->name);
-
+	g_free(pref->name);
 	pref->name = g_strdup(name);
 }
 
 const char *
-gaim_plugin_pref_get_name(GaimPluginPref *pref) {
-	g_return_val_if_fail(pref, NULL);
+gaim_plugin_pref_get_name(GaimPluginPref *pref)
+{
+	g_return_val_if_fail(pref != NULL, NULL);
 
 	return pref->name;
 }
 
 void
-gaim_plugin_pref_set_label(GaimPluginPref *pref, const char *label) {
-	g_return_if_fail(pref);
-	g_return_if_fail(label);
+gaim_plugin_pref_set_label(GaimPluginPref *pref, const char *label)
+{
+	g_return_if_fail(pref  != NULL);
+	g_return_if_fail(label != NULL);
 
-	if(pref->label)
-		g_free(pref->label);
-
+	g_free(pref->label);
 	pref->label = g_strdup(label);
 }
 
 const char *
-gaim_plugin_pref_get_label(GaimPluginPref *pref) {
-	g_return_val_if_fail(pref, NULL);
+gaim_plugin_pref_get_label(GaimPluginPref *pref)
+{
+	g_return_val_if_fail(pref != NULL, NULL);
 
 	return pref->label;
 }
 
 void
-gaim_plugin_pref_set_bounds(GaimPluginPref *pref, int min, int max) {
+gaim_plugin_pref_set_bounds(GaimPluginPref *pref, int min, int max)
+{
 	int tmp;
 
-	g_return_if_fail(pref);
-	g_return_if_fail(pref->name);
+	g_return_if_fail(pref       != NULL);
+	g_return_if_fail(pref->name != NULL);
 
-	if(gaim_prefs_get_type(pref->name) != GAIM_PREF_INT) {
-		gaim_debug(GAIM_DEBUG_INFO, "pluginpref",
+	if (gaim_prefs_get_type(pref->name) != GAIM_PREF_INT)
+	{
+		gaim_debug_info("pluginpref",
 				"gaim_plugin_pref_set_bounds: %s is not an integer pref\n",
 				pref->name);
 		return;
 	}
 
-	if(min > max) {
+	if (min > max)
+	{
 		tmp = min;
 		min = max;
 		max = tmp;
@@ -221,11 +213,13 @@
 	pref->max = max;
 }
 
-void gaim_plugin_pref_get_bounds(GaimPluginPref *pref, int *min, int *max) {
-	g_return_if_fail(pref);
-	g_return_if_fail(pref->name);
+void gaim_plugin_pref_get_bounds(GaimPluginPref *pref, int *min, int *max)
+{
+	g_return_if_fail(pref       != NULL);
+	g_return_if_fail(pref->name != NULL);
 
-	if(gaim_prefs_get_type(pref->name) != GAIM_PREF_INT) {
+	if (gaim_prefs_get_type(pref->name) != GAIM_PREF_INT)
+	{
 		gaim_debug(GAIM_DEBUG_INFO, "pluginpref",
 				"gaim_plugin_pref_get_bounds: %s is not an integer pref\n",
 				pref->name);
@@ -237,23 +231,26 @@
 }
 
 void
-gaim_plugin_pref_set_type(GaimPluginPref *pref, GaimPluginPrefType type) {
-	g_return_if_fail(pref);
+gaim_plugin_pref_set_type(GaimPluginPref *pref, GaimPluginPrefType type)
+{
+	g_return_if_fail(pref != NULL);
 
 	pref->type = type;
 }
 
 GaimPluginPrefType
-gaim_plugin_pref_get_type(GaimPluginPref *pref) {
-	g_return_val_if_fail(pref, GAIM_PLUGIN_PREF_NONE);
+gaim_plugin_pref_get_type(GaimPluginPref *pref)
+{
+	g_return_val_if_fail(pref != NULL, GAIM_PLUGIN_PREF_NONE);
 
 	return pref->type;
 }
 
 void
-gaim_plugin_pref_add_choice(GaimPluginPref *pref, const char *label, gpointer choice) {
-	g_return_if_fail(pref);
-	g_return_if_fail(label);
+gaim_plugin_pref_add_choice(GaimPluginPref *pref, const char *label, gpointer choice)
+{
+	g_return_if_fail(pref  != NULL);
+	g_return_if_fail(label != NULL);
 	g_return_if_fail(choice || gaim_prefs_get_type(pref->name) == GAIM_PREF_INT);
 
 	pref->choices = g_list_append(pref->choices, (gpointer)label);
@@ -261,36 +258,41 @@
 }
 
 GList *
-gaim_plugin_pref_get_choices(GaimPluginPref *pref) {
-	g_return_val_if_fail(pref, NULL);
+gaim_plugin_pref_get_choices(GaimPluginPref *pref)
+{
+	g_return_val_if_fail(pref != NULL, NULL);
 
 	return pref->choices;
 }
 
 void
-gaim_plugin_pref_set_max_length(GaimPluginPref *pref, unsigned int max_length) {
-	g_return_if_fail(pref);
+gaim_plugin_pref_set_max_length(GaimPluginPref *pref, unsigned int max_length)
+{
+	g_return_if_fail(pref != NULL);
 
 	pref->max_length = max_length;
 }
 
 unsigned int
-gaim_plugin_pref_get_max_length(GaimPluginPref *pref) {
-	g_return_val_if_fail(pref, 0);
+gaim_plugin_pref_get_max_length(GaimPluginPref *pref)
+{
+	g_return_val_if_fail(pref != NULL, 0);
 
 	return pref->max_length;
 }
 
 void
-gaim_plugin_pref_set_masked(GaimPluginPref *pref, gboolean masked) {
-	g_return_if_fail(pref);
+gaim_plugin_pref_set_masked(GaimPluginPref *pref, gboolean masked)
+{
+	g_return_if_fail(pref != NULL);
 
 	pref->masked = masked;
 }
 
 gboolean
-gaim_plugin_pref_get_masked(GaimPluginPref *pref) {
-	g_return_val_if_fail(pref, FALSE);
+gaim_plugin_pref_get_masked(GaimPluginPref *pref)
+{
+	g_return_val_if_fail(pref != NULL, FALSE);
 
 	return pref->masked;
 }
@@ -298,7 +300,7 @@
 void
 gaim_plugin_pref_set_format_type(GaimPluginPref *pref, GaimStringFormatType format)
 {
-	g_return_if_fail(pref);
+	g_return_if_fail(pref != NULL);
 	g_return_if_fail(pref->type == GAIM_PLUGIN_PREF_STRING_FORMAT);
 
 	pref->format = format;
@@ -307,11 +309,11 @@
 GaimStringFormatType
 gaim_plugin_pref_get_format_type(GaimPluginPref *pref)
 {
-	g_return_val_if_fail(pref, 0);
+	g_return_val_if_fail(pref != NULL, 0);
 
 	if (pref->type != GAIM_PLUGIN_PREF_STRING_FORMAT)
 		return GAIM_STRING_FORMAT_TYPE_NONE;
-	
+
 	return pref->format;
 }
 
--- a/src/pounce.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/pounce.c	Sat Aug 05 08:27:39 2006 +0000
@@ -521,8 +521,7 @@
 		data->account_name = NULL;
 	}
 
-	if (buffer != NULL)
-		g_free(buffer);
+	g_free(buffer);
 }
 
 static void
@@ -728,8 +727,7 @@
 	g_return_if_fail(pouncee != NULL);
 
 	g_free(pounce->pouncee);
-
-	pounce->pouncee = (pouncee == NULL ? NULL : g_strdup(pouncee));
+	pounce->pouncee = g_strdup(pouncee);
 
 	schedule_pounces_save();
 }
@@ -926,7 +924,7 @@
 			!gaim_utf8_strcasecmp(gaim_normalize(pouncer, gaim_pounce_get_pouncee(pounce)),
 								  norm_pouncee) &&
 			(pounce->options == GAIM_POUNCE_OPTION_NONE ||
-			 (pounce->options & GAIM_POUNCE_OPTION_AWAY && 
+			 (pounce->options & GAIM_POUNCE_OPTION_AWAY &&
 			  !gaim_presence_is_available(presence))))
 		{
 			handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type);
--- a/src/prefs.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/prefs.c	Sat Aug 05 08:27:39 2006 +0000
@@ -463,7 +463,6 @@
 {
 	GString *name;
 	struct gaim_pref *parent;
-	char *ret;
 
 	if(!pref)
 		return NULL;
@@ -479,9 +478,7 @@
 		name = g_string_prepend(name, parent->name);
 	}
 	name = g_string_prepend_c(name, '/');
-	ret = name->str;
-	g_string_free(name, FALSE);
-	return ret;
+	return g_string_free(name, FALSE);
 }
 
 static struct gaim_pref *
@@ -514,10 +511,7 @@
 			break;
 		case GAIM_PREF_STRING_LIST:
 			{
-				GList *tmp;
-				for(tmp = pref->value.stringlist; tmp; tmp = tmp->next)
-					g_free(tmp->data);
-
+				g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL);
 				g_list_free(pref->value.stringlist);
 			} break;
 		case GAIM_PREF_NONE:
@@ -794,15 +788,14 @@
 			return;
 		}
 
-		for(tmp = pref->value.stringlist; tmp; tmp = tmp->next)
-			g_free(tmp->data);
-
+		g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL);
 		g_list_free(pref->value.stringlist);
 		pref->value.stringlist = NULL;
 
 		for(tmp = value; tmp; tmp = tmp->next)
-			pref->value.stringlist = g_list_append(pref->value.stringlist,
+			pref->value.stringlist = g_list_prepend(pref->value.stringlist,
 					g_strdup(tmp->data));
+		pref->value.stringlist = g_list_reverse(pref->value.stringlist);
 
 		do_callbacks(name, pref);
 
@@ -904,7 +897,8 @@
 	}
 
 	for(tmp = pref->value.stringlist; tmp; tmp = tmp->next)
-		ret = g_list_append(ret, g_strdup(tmp->data));
+		ret = g_list_prepend(ret, g_strdup(tmp->data));
+	ret = g_list_reverse(ret);
 
 	return ret;
 }
--- a/src/protocols/oscar/oscar.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/protocols/oscar/oscar.c	Sat Aug 05 08:27:39 2006 +0000
@@ -1567,7 +1567,7 @@
 
 	pos->offset = offset;
 	pos->len = len;
-	pos->modname = modname ? g_strdup(modname) : NULL;
+	pos->modname = g_strdup(modname);
 
 	if (gaim_proxy_connect(pos->gc->account, "gaim.sourceforge.net", 80, straight_to_hell, pos) != 0)
 	{
--- a/src/protocols/qq/qq.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/protocols/qq/qq.c	Sat Aug 05 08:27:39 2006 +0000
@@ -946,8 +946,8 @@
 {
 	GaimAccountOption *option;
 
-	bindtextdomain(PACKAGE, LOCALEDIR);
-	bind_textdomain_codeset(PACKAGE, "UTF-8");
+	//bindtextdomain(PACKAGE, LOCALEDIR);
+	//bind_textdomain_codeset(PACKAGE, "UTF-8");
 
 	option = gaim_account_option_bool_new(_("Login in TCP"), "use_tcp", FALSE);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
--- a/src/proxy.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/proxy.c	Sat Aug 05 08:27:39 2006 +0000
@@ -107,8 +107,7 @@
 	g_return_if_fail(info != NULL);
 
 	g_free(info->host);
-
-	info->host = (host == NULL ? NULL : g_strdup(host));
+	info->host = g_strdup(host);
 }
 
 void
@@ -125,8 +124,7 @@
 	g_return_if_fail(info != NULL);
 
 	g_free(info->username);
-
-	info->username = (username == NULL ? NULL : g_strdup(username));
+	info->username = g_strdup(username);
 }
 
 void
@@ -135,8 +133,7 @@
 	g_return_if_fail(info != NULL);
 
 	g_free(info->password);
-
-	info->password = (password == NULL ? NULL : g_strdup(password));
+	info->password = g_strdup(password);
 }
 
 GaimProxyType
--- a/src/prpl.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/prpl.c	Sat Aug 05 08:27:39 2006 +0000
@@ -123,7 +123,7 @@
 gaim_prpl_got_user_status(GaimAccount *account, const char *name,
 		const char *status_id, ...)
 {
-	GSList *list, *iter;
+	GSList *list;
 	GaimBuddy *buddy;
 	GaimPresence *presence;
 	GaimStatus *status;
@@ -150,11 +150,7 @@
 	va_end(args);
 
 	list = gaim_find_buddies(account, name);
-	for (iter = list; iter != NULL; iter = iter->next)
-	{
-		buddy = (GaimBuddy *)iter->data;
-		gaim_blist_update_buddy_status(buddy, old_status);
-	}
+	g_slist_foreach(list, (GFunc)gaim_blist_update_buddy_status, old_status);
 	g_slist_free(list);
 
 	if (!gaim_status_is_online(status))
--- a/src/request.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/request.c	Sat Aug 05 08:27:39 2006 +0000
@@ -54,26 +54,12 @@
 void
 gaim_request_fields_destroy(GaimRequestFields *fields)
 {
-	GList *l;
-	GaimRequestFieldGroup *group;
-
 	g_return_if_fail(fields != NULL);
 
-	for (l = fields->groups; l != NULL; l = l->next)
-	{
-		group = l->data;
-
-		gaim_request_field_group_destroy(group);
-	}
-
-	if (fields->groups != NULL)
-		g_list_free(fields->groups);
-
-	if (fields->required_fields != NULL)
-		g_list_free(fields->required_fields);
-
+	g_list_foreach(fields->groups, (GFunc)gaim_request_field_group_destroy, NULL);
+	g_list_free(fields->groups);
+	g_list_free(fields->required_fields);
 	g_hash_table_destroy(fields->fields);
-
 	g_free(fields);
 }
 
@@ -263,8 +249,7 @@
 
 	group = g_new0(GaimRequestFieldGroup, 1);
 
-	if (title != NULL)
-		group->title = g_strdup(title);
+	group->title = g_strdup(title);
 
 	return group;
 }
@@ -272,20 +257,11 @@
 void
 gaim_request_field_group_destroy(GaimRequestFieldGroup *group)
 {
-	GaimRequestField *field;
-	GList *l;
-
 	g_return_if_fail(group != NULL);
 
-	if (group->title != NULL)
-		g_free(group->title);
+	g_free(group->title);
 
-	for (l = group->fields; l != NULL; l = l->next) {
-		field = l->data;
-
-		gaim_request_field_destroy(field);
-	}
-
+	g_list_foreach(group->fields, (GFunc)gaim_request_field_destroy, NULL);
 	g_list_free(group->fields);
 
 	g_free(group);
@@ -356,22 +332,14 @@
 {
 	g_return_if_fail(field != NULL);
 
-	if (field->id != NULL)
-		g_free(field->id);
-
-	if (field->label != NULL)
-		g_free(field->label);
-
-	if (field->type_hint != NULL)
-		g_free(field->type_hint);
+	g_free(field->id);
+	g_free(field->label);
+	g_free(field->type_hint);
 
 	if (field->type == GAIM_REQUEST_FIELD_STRING)
 	{
-		if (field->u.string.default_value != NULL)
-			g_free(field->u.string.default_value);
-
-		if (field->u.string.value != NULL)
-			g_free(field->u.string.value);
+		g_free(field->u.string.default_value);
+		g_free(field->u.string.value);
 	}
 	else if (field->type == GAIM_REQUEST_FIELD_CHOICE)
 	{
@@ -407,10 +375,8 @@
 {
 	g_return_if_fail(field != NULL);
 
-	if (field->label != NULL)
-		g_free(field->label);
-
-	field->label = (label == NULL ? NULL : g_strdup(label));
+	g_free(field->label);
+	field->label = g_strdup(label);
 }
 
 void
@@ -427,10 +393,8 @@
 {
 	g_return_if_fail(field != NULL);
 
-	if (field->type_hint != NULL)
-		g_free(field->type_hint);
-
-	field->type_hint = (type_hint == NULL ? NULL : g_strdup(type_hint));
+	g_free(field->type_hint);
+	field->type_hint = g_strdup(type_hint);
 }
 
 void
@@ -535,11 +499,8 @@
 	g_return_if_fail(field != NULL);
 	g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING);
 
-	if (field->u.string.default_value != NULL)
-		g_free(field->u.string.default_value);
-
-	field->u.string.default_value = (default_value == NULL
-									  ? NULL : g_strdup(default_value));
+	g_free(field->u.string.default_value);
+	field->u.string.default_value = g_strdup(default_value);
 }
 
 void
@@ -548,10 +509,8 @@
 	g_return_if_fail(field != NULL);
 	g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING);
 
-	if (field->u.string.value != NULL)
-		g_free(field->u.string.value);
-
-	field->u.string.value = (value == NULL ? NULL : g_strdup(value));
+	g_free(field->u.string.value);
+	field->u.string.value = g_strdup(value);
 }
 
 void
--- a/src/roomlist.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/roomlist.c	Sat Aug 05 08:27:39 2006 +0000
@@ -102,21 +102,14 @@
 	if (ops && ops->destroy)
 		ops->destroy(list);
 
-	if (list->rooms) {
-		for (l = list->rooms; l; l = l->next) {
-			GaimRoomlistRoom *r = l->data;
-			gaim_roomlist_room_destroy(list, r);
-		}
-		g_list_free(list->rooms);
+	for (l = list->rooms; l; l = l->next) {
+		GaimRoomlistRoom *r = l->data;
+		gaim_roomlist_room_destroy(list, r);
 	}
+	g_list_free(list->rooms);
 
-	if (list->fields) {
-		for (l = list->fields; l; l = l->next) {
-			GaimRoomlistField *f = l->data;
-			gaim_roomlist_field_destroy(f);
-		}
-		g_list_free(list->fields);
-	}
+	g_list_foreach(list->fields, (GFunc)gaim_roomlist_field_destroy, NULL);
+	g_list_free(list->fields);
 
 	g_free(list);
 }
--- a/src/server.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/server.c	Sat Aug 05 08:27:39 2006 +0000
@@ -366,8 +366,7 @@
 	gaim_signal_emit(gaim_conversations_get_handle(), "chat-invited-user",
 					 conv, name, buffy);
 
-	if (buffy)
-		g_free(buffy);
+	g_free(buffy);
 }
 
 /* Ya know, nothing uses this except gaim_conversation_destroy(),
@@ -471,10 +470,8 @@
 								  &angel, &buffy, cnv, &flags));
 
 	if (!buffy || !angel || plugin_return) {
-		if (buffy)
-			g_free(buffy);
-		if (angel)
-			g_free(angel);
+		g_free(buffy);
+		g_free(angel);
 		return;
 	}
 
@@ -563,7 +560,7 @@
 				 * _next_ message, so we still set lar->sent to now.
 				 */
 				lar->sent = now;
-				
+
 				if (!(flags & GAIM_MESSAGE_AUTO_RESP))
 				{
 					serv_send_im(gc, name, away_msg, GAIM_MESSAGE_AUTO_RESP);
--- a/src/signals.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/signals.c	Sat Aug 05 08:27:39 2006 +0000
@@ -83,16 +83,7 @@
 static void
 destroy_signal_data(GaimSignalData *signal_data)
 {
-	GaimSignalHandlerData *handler_data;
-	GList *l;
-
-	for (l = signal_data->handlers; l != NULL; l = l->next)
-	{
-		handler_data = (GaimSignalHandlerData *)l->data;
-
-		g_free(l->data);
-	}
-
+	g_list_foreach(signal_data->handlers, (GFunc)g_free, NULL);
 	g_list_free(signal_data->handlers);
 
 	if (signal_data->values != NULL)
--- a/src/socket.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/socket.c	Sat Aug 05 08:27:39 2006 +0000
@@ -4,7 +4,7 @@
  * Gaim is the legal property of its developers, whose names are too numerous
  * to list here.  Please refer to the COPYRIGHT file distributed with this
  * source distribution.
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
--- a/src/status.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/status.c	Sat Aug 05 08:27:39 2006 +0000
@@ -280,23 +280,14 @@
 void
 gaim_status_type_destroy(GaimStatusType *status_type)
 {
-	GList *l;
-
 	g_return_if_fail(status_type != NULL);
 
 	g_free(status_type->id);
 	g_free(status_type->name);
-
-	if (status_type->primary_attr_id != NULL)
-		g_free(status_type->primary_attr_id);
+	g_free(status_type->primary_attr_id);
 
-	if (status_type->attrs != NULL)
-	{
-		for (l = status_type->attrs; l != NULL; l = l->next)
-			gaim_status_attr_destroy((GaimStatusAttr *)l->data);
-
-		g_list_free(status_type->attrs);
-	}
+	g_list_foreach(status_type->attrs, (GFunc)gaim_status_attr_destroy, NULL);
+	g_list_free(status_type->attrs);
 
 	GAIM_DBUS_UNREGISTER_POINTER(status_type);
 	g_free(status_type);
@@ -307,10 +298,8 @@
 {
 	g_return_if_fail(status_type != NULL);
 
-	if (status_type->primary_attr_id != NULL)
-		g_free(status_type->primary_attr_id);
-
-	status_type->primary_attr_id = (id == NULL ? NULL : g_strdup(id));
+	g_free(status_type->primary_attr_id);
+	status_type->primary_attr_id = g_strdup(id);
 }
 
 void
@@ -1192,19 +1181,15 @@
 
 		g_hash_table_remove(buddy_presences, &key);
 
-		if (presence->u.buddy.name != NULL)
-			g_free(presence->u.buddy.name);
+		g_free(presence->u.buddy.name);
 	}
 	else if (gaim_presence_get_context(presence) == GAIM_PRESENCE_CONTEXT_CONV)
 	{
-		if (presence->u.chat.user != NULL)
-			g_free(presence->u.chat.user);
+		g_free(presence->u.chat.user);
 	}
 
-	if (presence->statuses != NULL) {
-		g_list_foreach(presence->statuses, (GFunc)gaim_status_destroy, NULL);
-		g_list_free(presence->statuses);
-	}
+	g_list_foreach(presence->statuses, (GFunc)gaim_status_destroy, NULL);
+	g_list_free(presence->statuses);
 
 	g_hash_table_destroy(presence->status_table);
 
--- a/src/util.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/util.c	Sat Aug 05 08:27:39 2006 +0000
@@ -926,8 +926,7 @@
 
 						/* don't store a blank attribute name */
 						if (len) {
-							if (name)
-								g_free(name);
+							g_free(name);
 							name = g_ascii_strdown(cur, len);
 						}
 
@@ -994,8 +993,7 @@
 	}
 
 	/* clean up any attribute name from a premature termination */
-	if (name)
-		g_free(name);
+	g_free(name);
 
 	if (found) {
 		*attributes = attribs;
@@ -1770,7 +1768,7 @@
 gaim_markup_linkify(const char *text)
 {
 	const char *c, *t, *q = NULL;
-	char *tmp, *tmpurlbuf, *url_buf;
+	char *tmpurlbuf, *url_buf;
 	gunichar g;
 	gboolean inside_html = FALSE;
 	int inside_paren = 0;
@@ -2023,9 +2021,7 @@
 		c++;
 
 	}
-	tmp = ret->str;
-	g_string_free(ret, FALSE);
-	return tmp;
+	return g_string_free(ret, FALSE);
 }
 
 char *
@@ -2110,8 +2106,7 @@
 				char *tmp;
 
 				tmp = g_queue_pop_head(q);
-				if (tmp)
-					g_free(tmp);
+				g_free(tmp);
 				/* z += 0; */
 			} else {
 				/* push it unto the stack */
@@ -3430,10 +3425,10 @@
 	gfud->callback = cb;
 	gfud->user_data  = user_data;
 	gfud->url = g_strdup(url);
-	gfud->user_agent = user_agent ? g_strdup(user_agent) : NULL;
+	gfud->user_agent = g_strdup(user_agent);
 	gfud->http11 = http11;
 	gfud->full = full;
-	gfud->request = request ? g_strdup(request) : NULL;
+	gfud->request = g_strdup(request);
 	gfud->include_headers = include_headers;
 
 	gaim_url_parse(url, &gfud->website.address, &gfud->website.port,
@@ -3677,8 +3672,7 @@
 	if ((utf8 != NULL) && (converted == strlen(str)))
 		return utf8;
 
-	if (utf8 != NULL)
-		g_free(utf8);
+	g_free(utf8);
 
 	return NULL;
 }
--- a/src/value.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/value.c	Sat Aug 05 08:27:39 2006 +0000
@@ -85,13 +85,11 @@
 
 	if (gaim_value_get_type(value) == GAIM_TYPE_BOXED)
 	{
-		if (value->u.specific_type != NULL)
-			g_free(value->u.specific_type);
+		g_free(value->u.specific_type);
 	}
 	else if (gaim_value_get_type(value) == GAIM_TYPE_STRING)
 	{
-		if (value->data.string_data != NULL)
-			g_free(value->data.string_data);
+		g_free(value->data.string_data);
 	}
 
 	g_free(value);
@@ -322,10 +320,8 @@
 {
 	g_return_if_fail(value != NULL);
 
-	if (value->data.string_data != NULL)
-		g_free(value->data.string_data);
-
-	value->data.string_data = (data == NULL ? NULL : g_strdup(data));
+	g_free(value->data.string_data);
+	value->data.string_data = g_strdup(data);
 }
 
 void
--- a/src/whiteboard.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/whiteboard.c	Sat Aug 05 08:27:39 2006 +0000
@@ -124,8 +124,7 @@
 
 void gaim_whiteboard_draw_list_destroy(GList *draw_list)
 {
-	if (draw_list)
-		g_list_free(draw_list);
+	g_list_free(draw_list);
 }
 
 gboolean gaim_whiteboard_get_dimensions(GaimWhiteboard *wb, int *width, int *height)
--- a/src/xmlnode.c	Sat Aug 05 05:42:28 2006 +0000
+++ b/src/xmlnode.c	Sat Aug 05 08:27:39 2006 +0000
@@ -48,8 +48,7 @@
 {
 	xmlnode *node = g_new0(xmlnode, 1);
 
-	if(name)
-		node->name = g_strdup(name);
+	node->name = g_strdup(name);
 	node->type = type;
 
 	return node;
@@ -181,12 +180,10 @@
 #ifdef HAVE_LIBXML
 	g_return_if_fail(node != NULL);
 
-	if (node->namespace)
-		g_free(node->namespace);
-	
+	g_free(node->namespace);
 	node->namespace = g_strdup(xmlns);
 #else
-	return xmlnode_set_attrib(node, "xmlns", xmlns);
+	xmlnode_set_attrib(node, "xmlns", xmlns);
 #endif
 }
 
@@ -215,13 +212,10 @@
 		x = y;
 	}
 
-	if(node->name)
-		g_free(node->name);
-	if(node->data)
-		g_free(node->data);
+	g_free(node->name);
+	g_free(node->data);
 #ifdef HAVE_LIBXML
-	if(node->namespace)
-		g_free(node->namespace);
+	g_free(node->namespace);
 #endif
 	g_free(node);
 }
@@ -311,7 +305,7 @@
 		g_string_append_printf(text, " xmlns='%s'", namespace);
 		g_free(namespace);
 	}
-#endif	
+#endif
 	for(c = node->child; c; c = c->next)
 	{
 		if(c->type == XMLNODE_TYPE_ATTRIB) {
@@ -353,8 +347,7 @@
 
 	g_free(node_name);
 
-	if(tab)
-		g_free(tab);
+	g_free(tab);
 
 	if(len)
 		*len = text->len;
@@ -422,7 +415,7 @@
 }
 
 static void
-xmlnode_parser_element_end_libxml(void *user_data, const xmlChar *element_name, 
+xmlnode_parser_element_end_libxml(void *user_data, const xmlChar *element_name,
 				 const xmlChar *prefix, const xmlChar *namespace)
 {
 	struct _xmlnode_parser_data *xpd = user_data;