/pidgin/main: 2561402bb3fd: Use g_slist_free_full and g_list_fre...
Mark Doliner
mark at kingant.net
Tue Jan 28 10:38:15 EST 2014
Changeset: 2561402bb3fd5cae47528b5afdd5dbb5cfbf97a2
Author: Mark Doliner <mark at kingant.net>
Date: 2014-01-20 10:23 -0800
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/2561402bb3fd
Description:
Use g_slist_free_full and g_list_free_full in a few places.
diffstat:
libpurple/protocols/oscar/family_icq.c | 5 +----
libpurple/protocols/yahoo/libymsg.c | 5 +----
libpurple/protocols/yahoo/yahoo_filexfer.c | 14 ++------------
libpurple/protocols/yahoo/ycht.c | 6 +-----
4 files changed, 5 insertions(+), 25 deletions(-)
diffs (79 lines):
diff --git a/libpurple/protocols/oscar/family_icq.c b/libpurple/protocols/oscar/family_icq.c
--- a/libpurple/protocols/oscar/family_icq.c
+++ b/libpurple/protocols/oscar/family_icq.c
@@ -771,10 +771,7 @@ snachandler(OscarData *od, FlapConnectio
static void
icq_shutdown(OscarData *od, aim_module_t *mod)
{
- GSList *cur;
- for (cur = od->icq_info; cur; cur = cur->next)
- aim_icq_freeinfo(cur->data);
- g_slist_free(od->icq_info);
+ g_slist_free_full(od->icq_info, aim_icq_freeinfo);
}
int
diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c
--- a/libpurple/protocols/yahoo/libymsg.c
+++ b/libpurple/protocols/yahoo/libymsg.c
@@ -3822,10 +3822,7 @@ void yahoo_close(PurpleConnection *gc) {
}
g_slist_free(yd->confs);
- for (l = yd->cookies; l; l = l->next) {
- g_free(l->data);
- }
- g_slist_free(yd->cookies);
+ g_slist_free_full(yd->cookies, g_free);
yd->chat_online = FALSE;
if (yd->in_chat)
diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c
@@ -64,7 +64,6 @@ yahoo_xfer_data_free(struct yahoo_xfer_d
PurpleConnection *gc;
YahooData *yd;
PurpleXfer *xfer;
- GSList *l;
gc = xd->gc;
yd = purple_connection_get_protocol_data(gc);
@@ -76,17 +75,8 @@ yahoo_xfer_data_free(struct yahoo_xfer_d
g_hash_table_remove(yd->xfer_peer_idstring_map, xd->xfer_peer_idstring);
}
- /* empty file & filesize list */
- for (l = xd->filename_list; l; l = l->next) {
- g_free(l->data);
- l->data=NULL;
- }
- for (l = xd->size_list; l; l = l->next) {
- g_free(l->data);
- l->data=NULL;
- }
- g_slist_free(xd->filename_list);
- g_slist_free(xd->size_list);
+ g_slist_free_full(xd->filename_list, g_free);
+ g_slist_free_full(xd->size_list, g_free);
g_free(xd->host);
g_free(xd->path);
diff --git a/libpurple/protocols/yahoo/ycht.c b/libpurple/protocols/yahoo/ycht.c
--- a/libpurple/protocols/yahoo/ycht.c
+++ b/libpurple/protocols/yahoo/ycht.c
@@ -415,13 +415,9 @@ static void ycht_packet_process(YchtConn
static void ycht_packet_free(YchtPkt *pkt)
{
- GList *l;
-
g_return_if_fail(pkt != NULL);
- for (l = pkt->data; l; l = l->next)
- g_free(l->data);
- g_list_free(pkt->data);
+ g_list_free_full(pkt->data, g_free);
g_free(pkt);
}
More information about the Commits
mailing list