Mercurial > pidgin
diff src/gtkblist.c @ 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 | 6fc412e59214 |
children | 36bb845aa622 |
line wrap: on
line diff
--- 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);