From: <the...@us...> - 2006-08-05 09:54:49
|
Revision: 16645 Author: thekingant Date: 2006-08-05 02:54:33 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16645&view=rev Log Message: ----------- Backport SVN revisions 16638 through 16643 from HEAD to v2_0_0 Original commit messages: thekingant * r16638 /trunk/ (61 files in 4 dirs): 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. thekingant * r16639 /trunk/doc/: Add doc/gntgaim.1 to the svn:ignore property thekingant * r16640 /trunk/ (8 files in 5 dirs): Remove the Napster PRPL thekingant * r16641 /trunk/src/ (gaim-socket.h socket.c): Remove the old src/gaim-socket.h and src/socket.c from Subversion thekingant * r16642 /trunk/src/ (mime.c mime.h): Formatting/whitespace thekingant * r16643 /trunk/src/ (gtkimhtml.c util.c): Return g_string_free(str, FALSE) directly instead of assigning str->str to a temporary directory and returning that. Modified Paths: -------------- branches/v2_0_0/ChangeLog branches/v2_0_0/Makefile.mingw branches/v2_0_0/configure.ac branches/v2_0_0/pixmaps/status/default/Makefile.am branches/v2_0_0/plugins/codeinline.c branches/v2_0_0/plugins/contact_priority.c branches/v2_0_0/plugins/dbus-example.c branches/v2_0_0/plugins/history.c branches/v2_0_0/plugins/log_reader.c branches/v2_0_0/plugins/timestamp.c branches/v2_0_0/po/POTFILES.in branches/v2_0_0/src/account.c branches/v2_0_0/src/accountopt.c branches/v2_0_0/src/blist.c branches/v2_0_0/src/buddyicon.c branches/v2_0_0/src/cipher.c branches/v2_0_0/src/cmds.c branches/v2_0_0/src/connection.c branches/v2_0_0/src/conversation.c branches/v2_0_0/src/core.c branches/v2_0_0/src/dbus-define-api.h branches/v2_0_0/src/dbus-server.h branches/v2_0_0/src/dbus-useful.c branches/v2_0_0/src/dbus-useful.h branches/v2_0_0/src/ft.c branches/v2_0_0/src/gaim-client-example.c branches/v2_0_0/src/gaim-client.c branches/v2_0_0/src/gtkaccount.c branches/v2_0_0/src/gtkblist.c branches/v2_0_0/src/gtkconv.c branches/v2_0_0/src/gtkdebug.c branches/v2_0_0/src/gtkft.c branches/v2_0_0/src/gtkimhtml.c branches/v2_0_0/src/gtkimhtmltoolbar.c branches/v2_0_0/src/gtklog.c branches/v2_0_0/src/gtkpluginpref.c branches/v2_0_0/src/gtkpounce.c branches/v2_0_0/src/gtkprefs.c branches/v2_0_0/src/gtkprivacy.c branches/v2_0_0/src/gtkrequest.c branches/v2_0_0/src/gtkroomlist.c branches/v2_0_0/src/gtksound.c branches/v2_0_0/src/gtkstatusbox.c branches/v2_0_0/src/gtkthemes.c branches/v2_0_0/src/gtkutils.c branches/v2_0_0/src/imgstore.c branches/v2_0_0/src/log.c branches/v2_0_0/src/mime.c branches/v2_0_0/src/mime.h branches/v2_0_0/src/notify.c branches/v2_0_0/src/plugin.c branches/v2_0_0/src/pluginpref.c branches/v2_0_0/src/pounce.c branches/v2_0_0/src/prefs.c branches/v2_0_0/src/protocols/Makefile.am branches/v2_0_0/src/protocols/oscar/oscar.c branches/v2_0_0/src/proxy.c branches/v2_0_0/src/prpl.c branches/v2_0_0/src/request.c branches/v2_0_0/src/roomlist.c branches/v2_0_0/src/server.c branches/v2_0_0/src/signals.c branches/v2_0_0/src/status.c branches/v2_0_0/src/util.c branches/v2_0_0/src/value.c branches/v2_0_0/src/whiteboard.c branches/v2_0_0/src/xmlnode.c Removed Paths: ------------- branches/v2_0_0/pixmaps/status/default/napster.png branches/v2_0_0/src/gaim-socket.h branches/v2_0_0/src/protocols/napster/ branches/v2_0_0/src/socket.c Property Changed: ---------------- branches/v2_0_0/doc/ branches/v2_0_0/plugins/codeinline.c Modified: branches/v2_0_0/ChangeLog =================================================================== --- branches/v2_0_0/ChangeLog 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/ChangeLog 2006-08-05 09:54:33 UTC (rev 16645) @@ -152,6 +152,7 @@ * SIP/SIMPLE support (Thomas Butter, Google Summer of Code) * Sametime protocol support Requires the meanwhile library: http://meanwhile.sourceforge.net + * Removed support for the napster and toc protocols Other Noteworthy Changes: * UPnP and NAT traversal support (Adam J. Warrington, Google Summer of Modified: branches/v2_0_0/Makefile.mingw =================================================================== --- branches/v2_0_0/Makefile.mingw 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/Makefile.mingw 2006-08-05 09:54:33 UTC (rev 16645) @@ -21,7 +21,6 @@ TOC = $(GAIM_PROTOS)/toc IRC = $(GAIM_PROTOS)/irc JABBER = $(GAIM_PROTOS)/jabber -NAPSTER = $(GAIM_PROTOS)/napster GG = $(GAIM_PROTOS)/gg NOVELL = $(GAIM_PROTOS)/novell SILC = $(GAIM_PROTOS)/silc Modified: branches/v2_0_0/configure.ac =================================================================== --- branches/v2_0_0/configure.ac 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/configure.ac 2006-08-05 09:54:33 UTC (rev 16645) @@ -1772,7 +1772,6 @@ src/protocols/irc/Makefile src/protocols/jabber/Makefile src/protocols/msn/Makefile - src/protocols/napster/Makefile src/protocols/novell/Makefile src/protocols/oscar/Makefile src/protocols/sametime/Makefile Property changes on: branches/v2_0_0/doc ___________________________________________________________________ Name: svn:ignore - Makefile.in Makefile html gaim.1 gaim-remote.1 + Makefile.in Makefile html gaim.1 gaim-remote.1 gntgaim.1 Modified: branches/v2_0_0/pixmaps/status/default/Makefile.am =================================================================== --- branches/v2_0_0/pixmaps/status/default/Makefile.am 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/pixmaps/status/default/Makefile.am 2006-08-05 09:54:33 UTC (rev 16645) @@ -26,7 +26,6 @@ male.png \ meanwhile.png \ msn.png \ - napster.png \ notauthorized.png \ novell.png \ occupied.png \ Deleted: branches/v2_0_0/pixmaps/status/default/napster.png =================================================================== (Binary files differ) Modified: branches/v2_0_0/plugins/codeinline.c =================================================================== --- branches/v2_0_0/plugins/codeinline.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/codeinline.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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; } Property changes on: branches/v2_0_0/plugins/codeinline.c ___________________________________________________________________ Name: svn:executable - * Modified: branches/v2_0_0/plugins/contact_priority.c =================================================================== --- branches/v2_0_0/plugins/contact_priority.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/contact_priority.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); Modified: branches/v2_0_0/plugins/dbus-example.c =================================================================== --- branches/v2_0_0/plugins/dbus-example.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/dbus-example.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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 = Modified: branches/v2_0_0/plugins/history.c =================================================================== --- branches/v2_0_0/plugins/history.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/history.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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) { Modified: branches/v2_0_0/plugins/log_reader.c =================================================================== --- branches/v2_0_0/plugins/log_reader.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/log_reader.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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(""); } Modified: branches/v2_0_0/plugins/timestamp.c =================================================================== --- branches/v2_0_0/plugins/timestamp.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/timestamp.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); } Modified: branches/v2_0_0/po/POTFILES.in =================================================================== --- branches/v2_0_0/po/POTFILES.in 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/po/POTFILES.in 2006-08-05 09:54:33 UTC (rev 16645) @@ -108,7 +108,6 @@ src/protocols/msn/state.c src/protocols/msn/switchboard.c src/protocols/msn/userlist.c -src/protocols/napster/napster.c src/protocols/novell/nmuser.c src/protocols/novell/novell.c src/protocols/oscar/flap_connection.c Modified: branches/v2_0_0/src/account.c =================================================================== --- branches/v2_0_0/src/account.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/account.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); } Modified: branches/v2_0_0/src/accountopt.c =================================================================== --- branches/v2_0_0/src/accountopt.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/accountopt.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); } Modified: branches/v2_0_0/src/blist.c =================================================================== --- branches/v2_0_0/src/blist.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/blist.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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; @@ -1052,7 +1052,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); @@ -2034,7 +2034,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); @@ -2045,8 +2045,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; Modified: branches/v2_0_0/src/buddyicon.c =================================================================== --- branches/v2_0_0/src/buddyicon.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/buddyicon.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); } Modified: branches/v2_0_0/src/cipher.c =================================================================== --- branches/v2_0_0/src/cipher.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/cipher.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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 Modified: branches/v2_0_0/src/cmds.c =================================================================== --- branches/v2_0_0/src/cmds.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/cmds.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); Modified: branches/v2_0_0/src/connection.c =================================================================== --- branches/v2_0_0/src/connection.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/connection.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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 Modified: branches/v2_0_0/src/conversation.c =================================================================== --- branches/v2_0_0/src/conversation.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/conversation.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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,11 +636,9 @@ { g_return_if_fail(conv != NULL); - if (conv->name != NULL) - g_free(conv->name); + g_free(conv->name); + conv->name = g_strdup(name); - conv->name = (name == NULL ? NULL : 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); + g_free(chat->who); + g_free(chat->topic); - chat->who = (who == NULL ? NULL : g_strdup(who)); - chat->topic = (topic == NULL ? NULL : g_strdup(topic)); + chat->who = g_strdup(who); + chat->topic = g_strdup(topic); gaim_conversation_update(gaim_conv_chat_get_conversation(chat), GAIM_CONV_UPDATE_TOPIC); @@ -1440,14 +1423,13 @@ g_list_free(flags2); } -int +static int gaim_conv_chat_cb_compare(GaimConvChatBuddy *a, GaimConvChatBuddy *b) { GaimConvChatBuddyFlags f1 = 0, f2 = 0; 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,11 +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->flags = 0; GAIM_DBUS_UNREGISTER_POINTER(cb); g_free(cb); Modified: branches/v2_0_0/src/core.c =================================================================== --- branches/v2_0_0/src/core.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/core.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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; Modified: branches/v2_0_0/src/dbus-define-api.h =================================================================== --- branches/v2_0_0/src/dbus-define-api.h 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/dbus-define-api.h 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); Modified: branches/v2_0_0/src/dbus-server.h =================================================================== --- branches/v2_0_0/src/dbus-server.h 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/dbus-server.h 2006-08-05 09:54:33 UTC (rev 16645) @@ -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. Modified: branches/v2_0_0/src/dbus-useful.c =================================================================== --- branches/v2_0_0/src/dbus-useful.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/dbus-useful.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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 (protocol_id && strcmp(account->protocol_id, protocol_id)) - continue; + if (name) + who = g_strdup(gaim_normalize(NULL, name)); + else + who = NULL; - if (account_test && !account_test(account)) - continue; + for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { + GaimAccount *account = (GaimAccount *)l->data; - result = account; - break; - } + if (who && strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who)) + continue; - g_free(who); + if (protocol_id && strcmp(account->protocol_id, protocol_id)) + continue; - return result; + if (account_test && !account_test(account)) + continue; + + result = account; + break; + } + + 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); } Modified: branches/v2_0_0/src/dbus-useful.h =================================================================== --- branches/v2_0_0/src/dbus-useful.h 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/dbus-useful.h 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); Modified: branches/v2_0_0/src/ft.c =================================================================== --- branches/v2_0_0/src/ft.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/ft.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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 Modified: branches/v2_0_0/src/gaim-client-example.c =================================================================== --- branches/v2_0_0/src/gaim-client-example.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gaim-client-example.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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(); - - 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); - } + gaim_init(); - g_list_free(alist); + 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); - return 0; + return 0; } Modified: branches/v2_0_0/src/gaim-client.c =================================================================== --- branches/v2_0_0/src/gaim-client.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gaim-client.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); } Deleted: branches/v2_0_0/src/gaim-socket.h =================================================================== --- branches/v2_0_0/src/gaim-socket.h 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gaim-socket.h 2006-08-05 09:54:33 UTC (rev 16645) @@ -1,45 +0,0 @@ -/* - * gaim-remote - * - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#ifndef _GAIM_GAIM_SOCKET_H_ -#define _GAIM_GAIM_SOCKET_H_ - -struct gaim_cui_packet { - guchar type; - guchar subtype; - guint32 length; - char *data; -}; - - -void cui_send_packet (int fd, struct gaim_cui_packet *p); -gint gaim_connect_to_session(gint session); -gboolean gaim_session_exists(int sess); - -struct gaim_cui_packet *cui_packet_new(guchar type, guchar subtype); -void cui_packet_free(struct gaim_cui_packet *p); -void cui_packet_append_string(struct gaim_cui_packet *p, char *str); -void cui_packet_append_char(struct gaim_cui_packet *p, char c); -void cui_packet_append_raw(struct gaim_cui_packet *p, char *str, int len); - - -#endif /* _GAIM_GAIM_SOCKET_H_ */ Modified: branches/v2_0_0/src/gtkaccount.c =================================================================== --- branches/v2_0_0/src/gtkaccount.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkaccount.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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,15 +1418,10 @@ gtk_widget_destroy(dialog->window); - if (dialog->user_split_entries != NULL) - g_list_free(dialog->user_split_entries); + g_list_free(dialog->user_split_entries); + g_list_free(dialog->protocol_opt_entries); + g_free(dialog->protocol_id); - if (dialog->protocol_opt_entries != NULL) - g_list_free(dialog->protocol_opt_entries); - - if (dialog->protocol_id != NULL) - g_free(dialog->protocol_id); - if (dialog->icon_path != NULL) { const char *icon = gaim_account_get_buddy_icon(dialog->account); @@ -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); Modified: branches/v2_0_0/src/gtkblist.c =================================================================== --- branches/v2_0_0/src/gtkblist.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkblist.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -541,9 +541,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) @@ -1508,8 +1506,7 @@ if (aims == NULL && icqs == NULL && yahoos == NULL && msns == NULL && jabbers == NULL) { - if (alias != NULL) - g_free(alias); + g_free(alias); return FALSE; } @@ -1520,8 +1517,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; } @@ -1583,7 +1579,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); @@ -1643,15 +1638,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); + (const guchar *)str->str, + strlen(str->str) + 1); - g_free(mime_str); + g_string_free(str, TRUE); gtk_tree_path_free(sourcerow); } } @@ -1867,9 +1860,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); @@ -4772,8 +4765,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; @@ -5805,7 +5797,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); Modified: branches/v2_0_0/src/gtkconv.c =================================================================== --- branches/v2_0_0/src/gtkconv.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkconv.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -193,15 +193,9 @@ static gint close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv) { - GList *list = g_list_copy(gtkconv->convs), *l; + GList *list = g_list_copy(gtkconv->convs); - l = list; - while (l) { - GaimConversation *conv = l->data; - gaim_conversation_destroy(conv); - l = l->next; - } - + g_list_foreach(list, (GFunc)gaim_conversation_destroy, NULL); g_list_free(list); return TRUE; @@ -488,8 +482,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) @@ -770,8 +763,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); } @@ -1425,7 +1418,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); @@ -1524,7 +1517,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 @@ -3213,8 +3206,7 @@ GaimBlistNode *gnode,*cnode,*bnode; static GList *tmp = NULL; - if (tmp) - g_list_free(tmp); + g_list_free(tmp); tmp = g_list_append(NULL, ""); @@ -4260,8 +4252,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); } @@ -4867,8 +4859,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) && @@ -5069,7 +5060,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); } @@ -5176,7 +5167,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); } Modified: branches/v2_0_0/src/gtkdebug.c =================================================================== --- branches/v2_0_0/src/gtkdebug.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkdebug.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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 Modified: branches/v2_0_0/src/gtkft.c =================================================================== --- branches/v2_0_0/src/gtkft.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkft.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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; } Modified: branches/v2_0_0/src/gtkimhtml.c =================================================================== --- branches/v2_0_0/src/gtkimhtml.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkimhtml.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -220,7 +220,6 @@ int length; GString *clipboard; gchar *tmp; - gchar *ret; if (html == NULL) return NULL; @@ -238,14 +237,8 @@ g_string_append(clipboard, "<!--StartFragment-->\r\n"); g_string_append(clipboard, html); g_string_append(clipboard, "\r\n<!--EndFragment-->"); - ret = clipboard->str; - g_string_free(clipboard, FALSE); -#if 0 /* Debugging for Windows clipboard */ - gaim_debug_info("imhtml clipboard", "from gaim: %s\n", ret); -#endif - - return ret; + return g_string_free(clipboard, FALSE); } static void clipboard_copy_html_win32(GtkIMHtml *imhtml) { @@ -1248,10 +1241,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); } @@ -2231,11 +2222,9 @@ e++; } } - g_free(val); - val = ret->str; - g_string_free(ret, FALSE); - return val; + + return g_string_free(ret, FALSE); } static const char *accepted_protocols[] = { @@ -2737,8 +2726,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 +2740,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 +3024,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 +3065,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 +3156,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 +3423,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 +3540,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 +3805,7 @@ strncmp(tag->name, "LINK ", 5) == 0 && imhtml->edit.link) { gtk_imhtml_toggle_link(imhtml, NULL); } - } + } } g_slist_free(tags); } @@ -3944,37 +3924,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 +3997,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; Modified: branches/v2_0_0/src/gtkimhtmltoolbar.c =================================================================== --- branches/v2_0_0/src/gtkimhtmltoolbar.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkimhtmltoolbar.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); } Modified: branches/v2_0_0/src/gtklog.c =================================================================== --- branches/v2_0_0/src/gtklog.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtklog.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); + gtk_widget_destroy(w); return TRUE; Modified: branches/v2_0_0/src/gtkpluginpref.c =================================================================== --- branches/v2_0_0/src/gtkpluginpref.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkpluginpref.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); } Modified: branches/v2_0_0/src/gtkpounce.c =================================================================== --- branches/v2_0_0/src/gtkpounce.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkpounce.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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); Modified: branches/v2_0_0/src/gtkprefs.c =================================================================== --- branches/v2_0_0/src/gtkprefs.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkprefs.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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) { Modified: branches/v2_0_0/src/gtkprivacy.c =================================================================== --- branches/v2_0_0/src/gtkprivacy.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkprivacy.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -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 ve... [truncated message content] |