pidgin/pidgin

Merged in default (pull request #580)

2019-10-01, Gary Kramlich
f0bd659d30c3
Merged in default (pull request #580)

Use g_list_free_full instead of g_list_foreach+g_list_free.

Approved-by: Gary Kramlich
--- a/finch/gntblist.c Tue Oct 01 07:19:14 2019 +0000
+++ b/finch/gntblist.c Tue Oct 01 07:24:51 2019 +0000
@@ -1928,8 +1928,7 @@
static void
destroy_status_list(GList *list)
{
- g_list_foreach(list, (GFunc)g_free, NULL);
- g_list_free(list);
+ g_list_free_full(list, g_free);
}
static void
--- a/finch/gntlog.c Tue Oct 01 07:19:14 2019 +0000
+++ b/finch/gntlog.c Tue Oct 01 07:24:51 2019 +0000
@@ -165,8 +165,7 @@
purple_request_close_with_handle(lv);
- g_list_foreach(lv->logs, (GFunc)purple_log_free, NULL);
- g_list_free(lv->logs);
+ g_list_free_full(lv->logs, (GDestroyNotify)purple_log_free);
g_free(lv->search);
g_free(lv);
--- a/finch/gntnotify.c Tue Oct 01 07:19:14 2019 +0000
+++ b/finch/gntnotify.c Tue Oct 01 07:24:51 2019 +0000
@@ -378,8 +378,7 @@
list = gnt_tree_get_selection_text_list(GNT_TREE(g_object_get_data(G_OBJECT(widget), "notify-tree")));
b->callback(purple_account_get_connection(account), list, data);
- g_list_foreach(list, (GFunc)g_free, NULL);
- g_list_free(list);
+ g_list_free_full(list, g_free);
}
static void
--- a/finch/gntplugin.c Tue Oct 01 07:19:14 2019 +0000
+++ b/finch/gntplugin.c Tue Oct 01 07:24:51 2019 +0000
@@ -160,8 +160,7 @@
static void
free_stringlist(GList *list)
{
- g_list_foreach(list, (GFunc)g_free, NULL);
- g_list_free(list);
+ g_list_free_full(list, g_free);
}
static gboolean
@@ -325,8 +324,7 @@
{
GList *list = g_object_get_data(G_OBJECT(plugins.tree), "seen-list");
purple_prefs_set_path_list("/finch/plugins/seen", list);
- g_list_foreach(list, (GFunc)g_free, NULL);
- g_list_free(list);
+ g_list_free_full(list, g_free);
plugins.window = NULL;
plugins.tree = NULL;
--- a/finch/gntprefs.c Tue Oct 01 07:19:14 2019 +0000
+++ b/finch/gntprefs.c Tue Oct 01 07:24:51 2019 +0000
@@ -213,8 +213,7 @@
static void
free_strings(void)
{
- g_list_foreach(pref_request.freestrings, (GFunc)g_free, NULL);
- g_list_free(pref_request.freestrings);
+ g_list_free_full(pref_request.freestrings, g_free);
pref_request.freestrings = NULL;
pref_request.showing = FALSE;
}
--- a/finch/plugins/gnthistory.c Tue Oct 01 07:19:14 2019 +0000
+++ b/finch/plugins/gnthistory.c Tue Oct 01 07:24:51 2019 +0000
@@ -127,8 +127,7 @@
purple_conversation_write_system_message(c, "<hr>", mflag);
- g_list_foreach(logs, (GFunc)purple_log_free, NULL);
- g_list_free(logs);
+ g_list_free_full(logs, (GDestroyNotify)purple_log_free);
}
static void
--- a/finch/plugins/gnttinyurl.c Tue Oct 01 07:19:14 2019 +0000
+++ b/finch/plugins/gnttinyurl.c Tue Oct 01 07:24:51 2019 +0000
@@ -237,11 +237,6 @@
purple_debug_info("TinyURL", "Conversation no longer exists... :(\n");
}
-static void free_urls(gpointer data, gpointer null)
-{
- g_free(data);
-}
-
static gboolean writing_msg(PurpleConversation *conv, PurpleMessage *msg, gpointer _unused)
{
GString *t;
@@ -252,9 +247,7 @@
return FALSE;
urls = g_object_get_data(G_OBJECT(conv), "TinyURLs");
- if (urls != NULL) /* message was cancelled somewhere? Reset. */
- g_list_foreach(urls, free_urls, NULL);
- g_list_free(urls);
+ g_list_free_full(urls, g_free);
urls = extract_urls(purple_message_get_contents(msg));
if (!urls)
return FALSE;
@@ -362,9 +355,7 @@
free_conv_urls(PurpleConversation *conv)
{
GList *urls = g_object_get_data(G_OBJECT(conv), "TinyURLs");
- if (urls)
- g_list_foreach(urls, free_urls, NULL);
- g_list_free(urls);
+ g_list_free_full(urls, g_free);
}
static void
--- a/libpurple/account.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/account.c Tue Oct 01 07:24:51 2019 +0000
@@ -1789,11 +1789,8 @@
priv = purple_account_get_instance_private(account);
/* Out with the old... */
- if (priv->status_types != NULL)
- {
- g_list_foreach(priv->status_types, (GFunc)purple_status_type_destroy, NULL);
- g_list_free(priv->status_types);
- }
+ g_list_free_full(priv->status_types,
+ (GDestroyNotify)purple_status_type_destroy);
/* In with the new... */
priv->status_types = status_types;
--- a/libpurple/accountopt.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/accountopt.c Tue Oct 01 07:24:51 2019 +0000
@@ -185,11 +185,8 @@
}
else if (option->type == PURPLE_PREF_STRING_LIST)
{
- if (option->default_value.list != NULL)
- {
- g_list_foreach(option->default_value.list, purple_account_option_list_free, NULL);
- g_list_free(option->default_value.list);
- }
+ g_list_free_full(option->default_value.list,
+ (GDestroyNotify)purple_account_option_list_free);
}
g_free(option);
@@ -250,11 +247,8 @@
g_return_if_fail(option != NULL);
g_return_if_fail(option->type == PURPLE_PREF_STRING_LIST);
- if (option->default_value.list != NULL)
- {
- g_list_foreach(option->default_value.list, purple_account_option_list_free, NULL);
- g_list_free(option->default_value.list);
- }
+ g_list_free_full(option->default_value.list,
+ (GDestroyNotify)purple_account_option_list_free);
option->default_value.list = values;
}
--- a/libpurple/buddylist.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/buddylist.c Tue Oct 01 07:24:51 2019 +0000
@@ -1780,8 +1780,7 @@
pce = parts->data;
chat_name = g_hash_table_lookup(purple_chat_get_components(chat),
pce->identifier);
- g_list_foreach(parts, (GFunc)g_free, NULL);
- g_list_free(parts);
+ g_list_free_full(parts, g_free);
if (purple_chat_get_account(chat) == account && chat_name != NULL &&
purple_strequal(purple_normalize(account, chat_name), normname)) {
--- a/libpurple/chat.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/chat.c Tue Oct 01 07:24:51 2019 +0000
@@ -89,8 +89,7 @@
GList *parts = purple_protocol_chat_iface_info(protocol, purple_account_get_connection(priv->account));
pce = parts->data;
ret = g_hash_table_lookup(priv->components, pce->identifier);
- g_list_foreach(parts, (GFunc)g_free, NULL);
- g_list_free(parts);
+ g_list_free_full(parts, g_free);
}
return ret;
--- a/libpurple/conversation.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/conversation.c Tue Oct 01 07:24:51 2019 +0000
@@ -522,8 +522,7 @@
g_return_if_fail(PURPLE_IS_CONVERSATION(conv));
priv = purple_conversation_get_instance_private(conv);
- g_list_foreach(priv->logs, (GFunc)purple_log_free, NULL);
- g_list_free(priv->logs);
+ g_list_free_full(priv->logs, (GDestroyNotify)purple_log_free);
priv->logs = NULL;
}
--- a/libpurple/conversationtypes.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/conversationtypes.c Tue Oct 01 07:24:51 2019 +0000
@@ -1487,8 +1487,7 @@
g_hash_table_destroy(priv->users);
priv->users = NULL;
- g_list_foreach(priv->ignored, (GFunc)g_free, NULL);
- g_list_free(priv->ignored);
+ g_list_free_full(priv->ignored, g_free);
priv->ignored = NULL;
g_free(priv->who);
--- a/libpurple/notify.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/notify.c Tue Oct 01 07:24:51 2019 +0000
@@ -266,8 +266,7 @@
for (l = results->rows; l; l = g_list_delete_link(l, l)) {
GList *row = l->data;
- g_list_foreach(row, (GFunc)g_free, NULL);
- g_list_free(row);
+ g_list_free_full(row, g_free);
}
for (l = results->columns; l; l = g_list_delete_link(l, l)) {
--- a/libpurple/pluginpref.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/pluginpref.c Tue Oct 01 07:24:51 2019 +0000
@@ -65,8 +65,7 @@
{
g_return_if_fail(frame != NULL);
- g_list_foreach(frame->prefs, (GFunc)purple_plugin_pref_destroy, NULL);
- g_list_free(frame->prefs);
+ g_list_free_full(frame->prefs, (GDestroyNotify)purple_plugin_pref_destroy);
g_free(frame);
}
--- a/libpurple/prefs.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/prefs.c Tue Oct 01 07:24:51 2019 +0000
@@ -595,10 +595,8 @@
break;
case PURPLE_PREF_STRING_LIST:
case PURPLE_PREF_PATH_LIST:
- {
- g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL);
- g_list_free(pref->value.stringlist);
- } break;
+ g_list_free_full(pref->value.stringlist, g_free);
+ break;
case PURPLE_PREF_NONE:
break;
}
@@ -989,8 +987,7 @@
return;
}
- g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL);
- g_list_free(pref->value.stringlist);
+ g_list_free_full(pref->value.stringlist, g_free);
pref->value.stringlist = NULL;
for(tmp = value; tmp; tmp = tmp->next) {
@@ -1055,8 +1052,7 @@
return;
}
- g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL);
- g_list_free(pref->value.stringlist);
+ g_list_free_full(pref->value.stringlist, g_free);
pref->value.stringlist = NULL;
for(tmp = value; tmp; tmp = tmp->next)
--- a/libpurple/presence.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/presence.c Tue Oct 01 07:24:51 2019 +0000
@@ -462,8 +462,7 @@
purple_presence_get_instance_private(PURPLE_PRESENCE(object));
if (priv->statuses) {
- g_list_foreach(priv->statuses, (GFunc)g_object_unref, NULL);
- g_list_free(priv->statuses);
+ g_list_free_full(priv->statuses, (GDestroyNotify)g_object_unref);
priv->statuses = NULL;
}
--- a/libpurple/protocols/jabber/caps.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/protocols/jabber/caps.c Tue Oct 01 07:24:51 2019 +0000
@@ -908,8 +908,7 @@
field->values);
}
} else {
- g_list_foreach(field->values, (GFunc) g_free, NULL);
- g_list_free(field->values);
+ g_list_free_full(field->values, g_free);
}
g_free(field->var);
--- a/libpurple/protocols/jabber/presence.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/protocols/jabber/presence.c Tue Oct 01 07:24:51 2019 +0000
@@ -492,18 +492,12 @@
if (!jbr) {
g_free(userdata->from);
g_free(userdata);
- if (exts) {
- g_list_foreach(exts, (GFunc)g_free, NULL);
- g_list_free(exts);
- }
+ g_list_free_full(exts, g_free);
return;
}
/* Any old jbr->caps.info is owned by the caps code */
- if (jbr->caps.exts) {
- g_list_foreach(jbr->caps.exts, (GFunc)g_free, NULL);
- g_list_free(jbr->caps.exts);
- }
+ g_list_free_full(jbr->caps.exts, g_free);
jbr->caps.info = info;
jbr->caps.exts = exts;
--- a/libpurple/request.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/request.c Tue Oct 01 07:24:51 2019 +0000
@@ -492,8 +492,8 @@
g_return_if_fail(fields != NULL);
g_strfreev(fields->tab_names);
- g_list_foreach(fields->groups, (GFunc)purple_request_field_group_destroy, NULL);
- g_list_free(fields->groups);
+ g_list_free_full(fields->groups,
+ (GDestroyNotify)purple_request_field_group_destroy);
g_list_free(fields->required_fields);
g_list_free(fields->validated_fields);
g_list_free(fields->autosensitive_fields);
@@ -842,8 +842,8 @@
g_free(group->title);
- g_list_foreach(group->fields, (GFunc)purple_request_field_destroy, NULL);
- g_list_free(group->fields);
+ g_list_free_full(group->fields,
+ (GDestroyNotify)purple_request_field_destroy);
g_free(group);
}
@@ -966,18 +966,8 @@
}
else if (field->type == PURPLE_REQUEST_FIELD_LIST)
{
- if (field->u.list.items != NULL)
- {
- g_list_foreach(field->u.list.items, (GFunc)g_free, NULL);
- g_list_free(field->u.list.items);
- }
-
- if (field->u.list.selected != NULL)
- {
- g_list_foreach(field->u.list.selected, (GFunc)g_free, NULL);
- g_list_free(field->u.list.selected);
- }
-
+ g_list_free_full(field->u.list.items, g_free);
+ g_list_free_full(field->u.list.selected, g_free);
g_hash_table_destroy(field->u.list.item_data);
g_hash_table_destroy(field->u.list.selected_table);
}
@@ -1669,8 +1659,7 @@
if (field->u.list.selected != NULL)
{
- g_list_foreach(field->u.list.selected, (GFunc)g_free, NULL);
- g_list_free(field->u.list.selected);
+ g_list_free_full(field->u.list.selected, g_free);
field->u.list.selected = NULL;
}
--- a/libpurple/roomlist.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/roomlist.c Tue Oct 01 07:24:51 2019 +0000
@@ -346,8 +346,7 @@
}
g_list_free(priv->rooms);
- g_list_foreach(priv->fields, (GFunc)purple_roomlist_field_free, NULL);
- g_list_free(priv->fields);
+ g_list_free_full(priv->fields, (GDestroyNotify)purple_roomlist_field_free);
G_OBJECT_CLASS(purple_roomlist_parent_class)->finalize(object);
}
--- a/libpurple/signals.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/signals.c Tue Oct 01 07:24:51 2019 +0000
@@ -77,9 +77,7 @@
static void
destroy_signal_data(PurpleSignalData *signal_data)
{
- g_list_foreach(signal_data->handlers, (GFunc)g_free, NULL);
- g_list_free(signal_data->handlers);
-
+ g_list_free_full(signal_data->handlers, g_free);
g_free(signal_data->value_types);
g_free(signal_data);
}
--- a/libpurple/status.c Tue Oct 01 07:19:14 2019 +0000
+++ b/libpurple/status.c Tue Oct 01 07:24:51 2019 +0000
@@ -344,8 +344,8 @@
g_free(status_type->id);
g_free(status_type->name);
- g_list_foreach(status_type->attrs, (GFunc)purple_status_attribute_destroy, NULL);
- g_list_free(status_type->attrs);
+ g_list_free_full(status_type->attrs,
+ (GDestroyNotify)purple_status_attribute_destroy);
g_free(status_type);
}
--- a/pidgin/gtkblist.c Tue Oct 01 07:19:14 2019 +0000
+++ b/pidgin/gtkblist.c Tue Oct 01 07:24:51 2019 +0000
@@ -2127,8 +2127,7 @@
}
}
- g_list_foreach(list, (GFunc)g_free, NULL);
- g_list_free(list);
+ g_list_free_full(list, g_free);
}
static gboolean
--- a/pidgin/gtkconv.c Tue Oct 01 07:19:14 2019 +0000
+++ b/pidgin/gtkconv.c Tue Oct 01 07:24:51 2019 +0000
@@ -236,8 +236,7 @@
{
PidginConversation *gtkconv = data;
GList *list = g_list_copy(gtkconv->convs);
- g_list_foreach(list, (GFunc)g_object_unref, NULL);
- g_list_free(list);
+ g_list_free_full(list, g_object_unref);
return FALSE;
}
@@ -4661,8 +4660,7 @@
}
gtkconv->send_history = g_list_first(gtkconv->send_history);
- g_list_foreach(gtkconv->send_history, (GFunc)g_free, NULL);
- g_list_free(gtkconv->send_history);
+ g_list_free_full(gtkconv->send_history, g_free);
if (gtkconv->attach_timer) {
g_source_remove(gtkconv->attach_timer);
--- a/pidgin/gtknotify.c Tue Oct 01 07:19:14 2019 +0000
+++ b/pidgin/gtknotify.c Tue Oct 01 07:24:51 2019 +0000
@@ -345,8 +345,7 @@
gtk_tree_model_get(GTK_TREE_MODEL(pounce_dialog->treemodel), &iter,
PIDGIN_POUNCE_DATA, &pounce_data,
-1);
- g_list_foreach(list, (GFunc)gtk_tree_path_free, NULL);
- g_list_free(list);
+ g_list_free_full(list, (GDestroyNotify)gtk_tree_path_free);
pounces = purple_pounces_get_all();
for (; pounces != NULL; pounces = pounces->next) {
@@ -499,8 +498,7 @@
button = bd->button;
button->callback(purple_account_get_connection(data->account), row, data->user_data);
- g_list_foreach(row, (GFunc)g_free, NULL);
- g_list_free(row);
+ g_list_free_full(row, g_free);
}
/* copy-paste from gtkrequest.c */
--- a/pidgin/gtkrequest.c Tue Oct 01 07:19:14 2019 +0000
+++ b/pidgin/gtkrequest.c Tue Oct 01 07:24:51 2019 +0000
@@ -1569,8 +1569,7 @@
sel_list = gtk_tree_selection_get_selected_rows(selection, &model);
gtk_tree_model_get_iter(model, &iter, sel_list->data);
- g_list_foreach(sel_list, (GFunc)gtk_tree_path_free, NULL);
- g_list_free(sel_list);
+ g_list_free_full(sel_list, (GDestroyNotify)gtk_tree_path_free);
gtk_tree_model_get(model, &iter, 0, &key, -1);
--- a/pidgin/gtksavedstatuses.c Tue Oct 01 07:19:14 2019 +0000
+++ b/pidgin/gtksavedstatuses.c Tue Oct 01 07:24:51 2019 +0000
@@ -209,8 +209,7 @@
purple_savedstatus_activate(saved_status);
}
- g_list_foreach(list, (GFunc)gtk_tree_path_free, NULL);
- g_list_free(list);
+ g_list_free_full(list, (GDestroyNotify)gtk_tree_path_free);
}
static void
@@ -247,8 +246,7 @@
status_window_delete_cancel_cb(gpointer data)
{
GList *sel_titles = data;
- g_list_foreach(sel_titles, (GFunc) g_free, NULL);
- g_list_free(sel_titles);
+ g_list_free_full(sel_titles, g_free);
}
static void
--- a/pidgin/pidginlog.c Tue Oct 01 07:19:14 2019 +0000
+++ b/pidgin/pidginlog.c Tue Oct 01 07:24:51 2019 +0000
@@ -267,8 +267,7 @@
purple_request_close_with_handle(lv);
- g_list_foreach(lv->logs, (GFunc)purple_log_free, NULL);
- g_list_free(lv->logs);
+ g_list_free_full(lv->logs, (GDestroyNotify)purple_log_free);
g_free(lv->search);
--- a/pidgin/plugins/gevolution/add_buddy_dialog.c Tue Oct 01 07:19:14 2019 +0000
+++ b/pidgin/plugins/gevolution/add_buddy_dialog.c Tue Oct 01 07:24:51 2019 +0000
@@ -45,11 +45,7 @@
{
gtk_widget_destroy(dialog->win);
- if (dialog->contacts != NULL)
- {
- g_list_foreach(dialog->contacts, (GFunc)g_object_unref, NULL);
- g_list_free(dialog->contacts);
- }
+ g_list_free_full(dialog->contacts, g_object_unref);
if (dialog->book != NULL)
g_object_unref(dialog->book);
@@ -224,8 +220,7 @@
if (pixbuf != NULL)
g_object_unref(G_OBJECT(pixbuf));
- g_list_foreach(list, (GFunc)g_free, NULL);
- g_list_free(list);
+ g_list_free_full(list, g_free);
}
static void
@@ -245,8 +240,7 @@
if (dialog->contacts != NULL)
{
- g_list_foreach(dialog->contacts, (GFunc)g_object_unref, NULL);
- g_list_free(dialog->contacts);
+ g_list_free_full(dialog->contacts, g_object_unref);
dialog->contacts = NULL;
}
--- a/pidgin/plugins/gevolution/assoc-buddy.c Tue Oct 01 07:19:14 2019 +0000
+++ b/pidgin/plugins/gevolution/assoc-buddy.c Tue Oct 01 07:24:51 2019 +0000
@@ -44,11 +44,7 @@
{
gtk_widget_destroy(dialog->win);
- if (dialog->contacts != NULL)
- {
- g_list_foreach(dialog->contacts, (GFunc)g_object_unref, NULL);
- g_list_free(dialog->contacts);
- }
+ g_list_free_full(dialog->contacts, g_object_unref);
g_object_unref(dialog->book);
gevo_addrbooks_model_unref(dialog->addrbooks);
@@ -147,8 +143,7 @@
if (dialog->contacts != NULL)
{
- g_list_foreach(dialog->contacts, (GFunc) g_object_unref, NULL);
- g_list_free(dialog->contacts);
+ g_list_free_full(dialog->contacts, g_object_unref);
dialog->contacts = NULL;
}
@@ -304,8 +299,7 @@
purple_debug_error("evolution", "Error adding contact to book\n");
/* Free the list. */
- g_list_foreach(list, (GFunc)g_free, NULL);
- g_list_free(list);
+ g_list_free_full(list, g_free);
delete_win_cb(NULL, NULL, dialog);
}
--- a/pidgin/plugins/gevolution/eds-utils.c Tue Oct 01 07:19:14 2019 +0000
+++ b/pidgin/plugins/gevolution/eds-utils.c Tue Oct 01 07:24:51 2019 +0000
@@ -137,7 +137,7 @@
/* Break off the first contact and free the rest. */
cards->next = NULL;
cards2->prev = NULL;
- g_list_foreach(cards2, (GFunc)g_object_unref, NULL);
+ g_list_free_full(cards2, g_object_unref);
}
/* Free the whole list. */
--- a/pidgin/plugins/gevolution/gevolution.c Tue Oct 01 07:19:14 2019 +0000
+++ b/pidgin/plugins/gevolution/gevolution.c Tue Oct 01 07:24:51 2019 +0000
@@ -110,8 +110,7 @@
g_free(me);
}
- g_list_foreach(ims, (GFunc)g_free, NULL);
- g_list_free(ims);
+ g_list_free_full(ims, g_free);
}
static void
--- a/pidgin/plugins/history.c Tue Oct 01 07:19:14 2019 +0000
+++ b/pidgin/plugins/history.c Tue Oct 01 07:24:51 2019 +0000
@@ -167,8 +167,7 @@
g_object_ref(G_OBJECT(gtkconv->webview));
g_idle_add(_scroll_webview_to_end, gtkconv->webview);
- g_list_foreach(logs, (GFunc)purple_log_free, NULL);
- g_list_free(logs);
+ g_list_free_full(logs, (GDestroyNotify)purple_log_free);
}
static void