Use GSList functions instead of manual iterations
--- a/libpurple/account.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/account.c Wed Oct 16 01:06:17 2019 +0300
@@ -1072,15 +1072,8 @@
g_hash_table_destroy(priv->settings);
g_hash_table_destroy(priv->ui_settings);
- g_free(priv->deny->data);
- priv->deny = g_slist_delete_link(priv->deny, priv->deny);
- g_free(priv->permit->data);
- priv->permit = g_slist_delete_link(priv->permit, priv->permit);
+ g_slist_free_full(priv->deny, g_free); + g_slist_free_full(priv->permit, g_free); G_OBJECT_CLASS(purple_account_parent_class)->finalize(object);
@@ -2291,7 +2284,6 @@
purple_account_privacy_permit_add(PurpleAccount *account, const char *who,
PurpleAccountPrivate *priv;
@@ -2303,14 +2295,7 @@
priv = purple_account_get_instance_private(account);
name = g_strdup(purple_normalize(account, who));
- for (l = priv->permit; l != NULL; l = l->next) {
- if (g_str_equal(name, l->data))
- /* This buddy already exists */
+ if (g_slist_find_custom(priv->permit, name, (GCompareFunc)g_strcmp0) != NULL) { /* This buddy already exists, so bail out */
@@ -2352,12 +2337,7 @@
priv = purple_account_get_instance_private(account);
name = purple_normalize(account, who);
- for (l = priv->permit; l != NULL; l = l->next) {
- if (g_str_equal(name, l->data))
- /* We found the buddy we were looking for */
+ l = g_slist_find_custom(priv->permit, name, (GCompareFunc)g_strcmp0); /* We didn't find the buddy we were looking for, so bail out */
@@ -2389,7 +2369,6 @@
purple_account_privacy_deny_add(PurpleAccount *account, const char *who,
PurpleAccountPrivate *priv;
@@ -2401,14 +2380,7 @@
priv = purple_account_get_instance_private(account);
name = g_strdup(purple_normalize(account, who));
- for (l = priv->deny; l != NULL; l = l->next) {
- if (g_str_equal(name, l->data))
- /* This buddy already exists */
+ if (g_slist_find_custom(priv->deny, name, (GCompareFunc)g_strcmp0) != NULL) { /* This buddy already exists, so bail out */
@@ -2449,12 +2421,7 @@
priv = purple_account_get_instance_private(account);
normalized = purple_normalize(account, who);
- for (l = priv->deny; l != NULL; l = l->next) {
- if (g_str_equal(normalized, l->data))
- /* We found the buddy we were looking for */
+ l = g_slist_find_custom(priv->deny, normalized, (GCompareFunc)g_strcmp0); /* We didn't find the buddy we were looking for, so bail out */
@@ -2599,7 +2566,6 @@
purple_account_privacy_check(PurpleAccount *account, const char *who)
PurpleAccountPrivate *priv = purple_account_get_instance_private(account);
switch (purple_account_get_privacy_type(account)) {
@@ -2611,19 +2577,11 @@
case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS:
who = purple_normalize(account, who);
- for (list=priv->permit; list!=NULL; list=list->next) {
- if (g_str_equal(who, list->data))
+ return (g_slist_find_custom(priv->permit, who, (GCompareFunc)g_strcmp0) != NULL); case PURPLE_ACCOUNT_PRIVACY_DENY_USERS:
who = purple_normalize(account, who);
- for (list=priv->deny; list!=NULL; list=list->next) {
- if (g_str_equal(who, list->data))
+ return (g_slist_find_custom(priv->deny, who, (GCompareFunc)g_strcmp0) == NULL); case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST:
return (purple_blist_find_buddy(account, who) != NULL);
--- a/libpurple/connection.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/connection.c Wed Oct 16 01:06:17 2019 +0300
@@ -855,13 +855,7 @@
purple_signal_emit(purple_connections_get_handle(), "signing-off", gc);
- while (priv->active_chats)
- PurpleChatConversation *b = priv->active_chats->data;
- priv->active_chats = g_slist_remove(priv->active_chats, b);
- purple_chat_conversation_leave(b);
+ g_slist_free_full(priv->active_chats, (GDestroyNotify)purple_chat_conversation_leave); update_keepalive(gc, FALSE);
--- a/libpurple/prefs.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/prefs.c Wed Oct 16 01:06:17 2019 +0300
@@ -763,7 +763,6 @@
remove_pref(struct purple_pref *pref)
@@ -794,11 +793,7 @@
- while((l = pref->callbacks) != NULL) {
- pref->callbacks = pref->callbacks->next;
+ g_slist_free_full(pref->callbacks, g_free); --- a/libpurple/protocols/bonjour/buddy.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/bonjour/buddy.c Wed Oct 16 01:06:17 2019 +0300
@@ -243,10 +243,7 @@
bonjour_buddy_delete(BonjourBuddy *buddy)
- while (buddy->ips != NULL) {
- g_free(buddy->ips->data);
- buddy->ips = g_slist_delete_link(buddy->ips, buddy->ips);
+ g_slist_free_full(buddy->ips, g_free); --- a/libpurple/protocols/bonjour/jabber.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/bonjour/jabber.c Wed Oct 16 01:06:17 2019 +0300
@@ -801,7 +801,7 @@
PurpleConversation *conv = NULL;
PurpleAccount *account = NULL;
if (error && error->code == G_IO_ERROR_CANCELLED) {
/* This conversation was closed before it started. */
@@ -821,8 +821,7 @@
* presence recieved (e.g. multiple interfaces).
* We need to make sure that we find the previously used entry.
- while (tmp && bb->conversation->ip_link != tmp->data)
- tmp = g_slist_next(tmp);
+ tmp = g_slist_find(bb->ips, bb->conversation->ip_link); @@ -1254,10 +1253,7 @@
- while (jdata->pending_conversations != NULL) {
- bonjour_jabber_close_conversation(jdata->pending_conversations->data);
- jdata->pending_conversations = g_slist_delete_link(jdata->pending_conversations, jdata->pending_conversations);
+ g_slist_free_full(jdata->pending_conversations, (GDestroyNotify)bonjour_jabber_close_conversation); @@ -1309,21 +1305,19 @@
gboolean blocked = FALSE;
PurpleAccount *acc = purple_buddy_get_account(pb);
- acc = purple_buddy_get_account(pb);
+ l = purple_account_privacy_get_denied(acc); + name = purple_buddy_get_name(pb); - for(l = purple_account_privacy_get_denied(acc); l != NULL; l = l->next) {
- const gchar *name = purple_buddy_get_name(pb);
+ if(g_slist_find_custom(l, name, (GCompareFunc)purple_utf8_strcasecmp) != NULL) { const gchar *username = bonjour_get_jid(acc);
- if(!purple_utf8_strcasecmp(name, (char *)l->data)) {
- purple_debug_info("bonjour", "%s has been blocked by %s.\n", name, username);
+ purple_debug_info("bonjour", "%s has been blocked by %s.\n", name, username); --- a/libpurple/protocols/bonjour/mdns_avahi.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/bonjour/mdns_avahi.c Wed Oct 16 01:06:17 2019 +0300
@@ -603,11 +603,7 @@
if (idata->buddy_icon_rec_browser != NULL)
avahi_record_browser_free(idata->buddy_icon_rec_browser);
- while(idata->resolvers != NULL) {
- AvahiSvcResolverData *rd = idata->resolvers->data;
- _cleanup_resolver_data(rd);
- idata->resolvers = g_slist_delete_link(idata->resolvers, idata->resolvers);
+ g_slist_free_full(idata->resolvers, (GDestroyNotify)_cleanup_resolver_data); --- a/libpurple/protocols/irc/parse.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/irc/parse.c Wed Oct 16 01:06:17 2019 +0300
@@ -239,11 +239,7 @@
void irc_unregister_commands(void)
- PurpleCmdId id = GPOINTER_TO_UINT(cmds->data);
- purple_cmd_unregister(id);
- cmds = g_slist_delete_link(cmds, cmds);
+ g_slist_free_full(cmds, (GDestroyNotify)purple_cmd_unregister); static char *irc_send_convert(struct irc_conn *irc, const char *string)
--- a/libpurple/protocols/jabber/auth.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/jabber/auth.c Wed Oct 16 01:06:17 2019 +0300
@@ -178,10 +178,7 @@
- g_free(mechanisms->data);
- mechanisms = g_slist_delete_link(mechanisms, mechanisms);
+ g_slist_free_full(mechanisms, g_free); if (js->auth_mech == NULL) {
/* Found no good mechanisms... */
--- a/libpurple/protocols/jabber/buddy.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/jabber/buddy.c Wed Oct 16 01:06:17 2019 +0300
@@ -880,10 +880,7 @@
purple_notify_userinfo(jbi->js->gc, jbi->jid, user_info, NULL, NULL);
- while (jbi->vcard_images) {
- g_object_unref(jbi->vcard_images->data);
- jbi->vcard_images = g_slist_delete_link(jbi->vcard_images, jbi->vcard_images);
+ g_slist_free_full(jbi->vcard_images, g_object_unref); jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi);
@@ -892,20 +889,18 @@
static void jabber_buddy_info_remove_id(JabberBuddyInfo *jbi, const char *id)
+ l = g_slist_find_custom(jbi->ids, id, (GCompareFunc)g_strcmp0); - if(purple_strequal(id, comp_id)) {
- jbi->ids = g_slist_remove(jbi->ids, comp_id);
+ jbi->ids = g_slist_remove(jbi->ids, comp_id); --- a/libpurple/protocols/jabber/google/google_roster.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/jabber/google/google_roster.c Wed Oct 16 01:06:17 2019 +0300
@@ -33,14 +33,11 @@
const char *jid = purple_xmlnode_get_attrib(item, "jid");
char *jid_norm = (char *)jabber_normalize(account, jid);
- if (purple_strequal(jid_norm, (char*)list->data)) {
- purple_xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER);
- purple_xmlnode_set_attrib(query, "gr:ext", "2");
- purple_xmlnode_set_attrib(item, "gr:t", "B");
+ if (g_slist_find_custom(list, jid_norm, (GCompareFunc)g_strcmp0)) { + purple_xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); + purple_xmlnode_set_attrib(query, "gr:ext", "2"); + purple_xmlnode_set_attrib(item, "gr:t", "B"); @@ -75,10 +72,7 @@
purple_debug_info("jabber", "Removing %s from local buddy list\n",
- purple_blist_remove_buddy(buddies->data);
- buddies = g_slist_delete_link(buddies, buddies);
+ g_slist_free_full(buddies, (GDestroyNotify)purple_blist_remove_buddy); --- a/libpurple/protocols/jabber/jabber.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/jabber/jabber.c Wed Oct 16 01:06:17 2019 +0300
@@ -3767,10 +3767,7 @@
static void cmds_free_func(gpointer value)
GSList *commands = value;
- purple_cmd_unregister(GPOINTER_TO_UINT(commands->data));
- commands = g_slist_delete_link(commands, commands);
+ g_slist_free_full(commands, (GDestroyNotify)purple_cmd_unregister); static void jabber_unregister_commands(PurpleProtocol *protocol)
--- a/libpurple/protocols/jabber/presence.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/jabber/presence.c Wed Oct 16 01:06:17 2019 +0300
@@ -1055,11 +1055,7 @@
- while (presence.chat_info.codes)
- presence.chat_info.codes =
- g_slist_delete_link(presence.chat_info.codes,
- presence.chat_info.codes);
+ g_slist_free(presence.chat_info.codes); g_free(presence.vcard_avatar_hash);
g_free(presence.nickname);
--- a/libpurple/protocols/jabber/roster.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/jabber/roster.c Wed Oct 16 01:06:17 2019 +0300
@@ -94,14 +94,11 @@
static void remove_purple_buddies(JabberStream *js, const char *jid)
buddies = purple_blist_find_buddies(purple_connection_get_account(js->gc), jid);
- for(l = buddies; l; l = l->next)
- purple_blist_remove_buddy(l->data);
+ g_slist_free_full(buddies, (GDestroyNotify)purple_blist_remove_buddy); static void add_purple_buddy_to_groups(JabberStream *js, const char *jid,
--- a/libpurple/protocols/jabber/xdata.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/jabber/xdata.c Wed Oct 16 01:06:17 2019 +0300
@@ -141,10 +141,7 @@
g_hash_table_destroy(data->fields);
- g_free(data->values->data);
- data->values = g_slist_delete_link(data->values, data->values);
+ g_slist_free_full(data->values, g_free); g_list_free_full(data->actions, g_free);
@@ -163,10 +160,7 @@
JabberStream *js = data->js;
gboolean hasActions = (data->actions != NULL);
g_hash_table_destroy(data->fields);
- g_free(data->values->data);
- data->values = g_slist_delete_link(data->values, data->values);
+ g_slist_free_full(data->values, g_free); g_list_free_full(data->actions, g_free);
--- a/libpurple/protocols/novell/nmconference.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/novell/nmconference.c Wed Oct 16 01:06:17 2019 +0300
@@ -165,8 +165,7 @@
nm_release_user_record((NMUserRecord *) element->data);
conference->participants =
- g_slist_remove_link(conference->participants, element);
- g_slist_free_1(element);
+ g_slist_delete_link(conference->participants, element); --- a/libpurple/protocols/novell/nmconn.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/novell/nmconn.c Wed Oct 16 01:06:17 2019 +0300
@@ -182,12 +182,7 @@
void nm_release_conn(NMConn *conn)
- for (node = conn->requests; node; node = node->next) {
- nm_release_request(node->data);
- g_slist_free(conn->requests);
+ g_slist_free_full(conn->requests, (GDestroyNotify)nm_release_request); --- a/libpurple/protocols/novell/nmcontact.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/novell/nmcontact.c Wed Oct 16 01:06:17 2019 +0300
@@ -863,35 +863,17 @@
_release_folder_contacts(NMFolder * folder)
- for (cnode = folder->contacts; cnode; cnode = cnode->next) {
- nm_release_contact(contact);
- g_slist_free(folder->contacts);
+ g_slist_free_full(folder->contacts, (GDestroyNotify)nm_release_contact); _release_folder_folders(NMFolder * folder)
- for (fnode = folder->folders; fnode; fnode = fnode->next) {
- subfolder = fnode->data;
- nm_release_folder(subfolder);
- g_slist_free(folder->folders);
+ g_slist_free_full(folder->folders, (GDestroyNotify)nm_release_folder); --- a/libpurple/protocols/novell/nmrtf.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/novell/nmrtf.c Wed Oct 16 01:06:17 2019 +0300
@@ -244,7 +244,6 @@
for (node = ctx->font_table; node; node = node->next) {
@@ -254,12 +253,7 @@
g_slist_free(ctx->font_table);
- for (node = ctx->saved; node; node = node->next) {
- g_slist_free(ctx->saved);
+ g_slist_free_full(ctx->saved, g_free); g_string_free(ctx->ansi, TRUE);
g_string_free(ctx->output, TRUE);
@@ -489,8 +483,7 @@
- ctx->saved = g_slist_remove_link(ctx->saved, link_old);
- g_slist_free_1(link_old);
+ ctx->saved = g_slist_delete_link(ctx->saved, link_old); --- a/libpurple/protocols/novell/nmuser.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/novell/nmuser.c Wed Oct 16 01:06:17 2019 +0300
@@ -942,11 +942,10 @@
/* Remove item from the cached list */
if ((node = g_slist_find_custom(*list_ptr, dn, (GCompareFunc)purple_utf8_strcasecmp))) {
- *list_ptr = g_slist_remove_link(*list_ptr, node);
+ *list_ptr = g_slist_delete_link(*list_ptr, node); - fields = nm_field_add_pointer(fields, tag, 0, NMFIELD_METHOD_DELETE, 0,
+ fields = nm_field_add_pointer(fields, tag, 0, NMFIELD_METHOD_DELETE, 0, g_strdup(dn), NMFIELD_TYPE_DN);
rc = nm_send_request(user->conn, "updateblocks", fields, callback, data, NULL);
@@ -1070,22 +1069,11 @@
nm_conference_list_free(NMUser * user)
- NMConference *conference;
- if (user->conferences) {
- for (cnode = user->conferences; cnode; cnode = cnode->next) {
- conference = cnode->data;
- nm_release_conference(conference);
- g_slist_free(user->conferences);
- user->conferences = NULL;
+ g_slist_free_full(user->conferences, (GDestroyNotify)nm_release_conference); + user->conferences = NULL; @@ -1520,14 +1508,11 @@
nm_conference_add_participant(conference, user_record);
/* Find the user in the list and remove it */
- for (node = list; node; node = node->next) {
- if (nm_utf8_str_equal(nm_user_record_get_dn(user_record),
- (const char *) node->data)) {
- list = g_slist_delete_link(list, node);
- nm_request_set_user_define(request, list);
+ node = g_slist_find_custom(list, nm_user_record_get_dn(user_record), (GCompareFunc)purple_utf8_strcasecmp); + list = g_slist_delete_link(list, node); + nm_request_set_user_define(request, list); --- a/libpurple/protocols/novell/novell.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/novell/novell.c Wed Oct 16 01:06:17 2019 +0300
@@ -1242,7 +1242,6 @@
const char *gname = NULL;
@@ -1276,12 +1275,7 @@
- for (l = rem_list; l; l = l->next) {
- purple_blist_remove_buddy(l->data);
- g_slist_free(rem_list);
+ g_slist_free_full(rem_list, (GDestroyNotify)purple_blist_remove_buddy); /* Add all of the contacts in the given folder to the Purple buddy list */
--- a/libpurple/protocols/oscar/flap_connection.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/oscar/flap_connection.c Wed Oct 16 01:06:17 2019 +0300
@@ -500,11 +500,7 @@
flap_connection_destroy_chat(od, conn);
g_slist_free(conn->groups);
- while (conn->rateclasses != NULL)
- g_free(conn->rateclasses->data);
- conn->rateclasses = g_slist_delete_link(conn->rateclasses, conn->rateclasses);
+ g_slist_free_full(conn->rateclasses, g_free); g_hash_table_destroy(conn->rateclass_members);
@@ -651,15 +647,11 @@
for (cur = od->oscar_connections; cur != NULL; cur = cur->next)
- for (l = conn->groups; l != NULL; l = l->next)
- if (GPOINTER_TO_UINT(l->data) == group)
+ if (g_slist_find(conn->groups, GUINT_TO_POINTER(group)) != NULL) --- a/libpurple/protocols/oscar/oscar.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/oscar/oscar.c Wed Oct 16 01:06:17 2019 +0300
@@ -878,12 +878,7 @@
od = purple_connection_get_protocol_data(gc);
- while (od->oscar_chats)
- struct chat_connection *cc = od->oscar_chats->data;
- od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
- oscar_chat_destroy(cc);
+ g_slist_free_full(od->oscar_chats, (GDestroyNotify)oscar_chat_destroy); struct create_room *cr = od->create_rooms->data;
@@ -2980,10 +2975,9 @@
/* Don't send if this turkey is in our deny list */
PurpleAccount *account = purple_connection_get_account(gc);
- for (list=purple_account_privacy_get_denied(account); (list && oscar_util_name_compare(name, list->data)); list=list->next);
+ GSList *list = purple_account_privacy_get_denied(account); + if (!g_slist_find_custom(list, name, (GCompareFunc)oscar_util_name_compare)) { struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, name));
if (bi && bi->typingnot) {
if (state == PURPLE_IM_TYPING)
@@ -3775,10 +3769,7 @@
cur = g_slist_prepend(cur, b);
- purple_blist_remove_buddy(cur->data);
- cur = g_slist_delete_link(cur, cur);
+ g_slist_free_full(cur, (GDestroyNotify)purple_blist_remove_buddy); /* Permit list (ICQ doesn't have one) */
@@ -3889,8 +3880,8 @@
case AIM_SSI_TYPE_PERMIT: { /* Permit buddy (unless we're on ICQ) */
if (!od->icq && curitem->name) {
- for (cur = purple_account_privacy_get_permitted(account); (cur && oscar_util_name_compare(curitem->name, cur->data)); cur = cur->next);
+ cur = purple_account_privacy_get_permitted(account); + if (!g_slist_find_custom(cur, curitem->name, (GCompareFunc)oscar_util_name_compare)) { purple_debug_info("oscar",
"ssi: adding permit buddy %s to local list\n", curitem->name);
purple_account_privacy_permit_add(account, curitem->name, TRUE);
@@ -3901,8 +3892,8 @@
case AIM_SSI_TYPE_ICQDENY:
case AIM_SSI_TYPE_DENY: { /* Deny buddy */
if (curitem->type == deny_entry_type && curitem->name) {
- for (cur = purple_account_privacy_get_denied(account); (cur && oscar_util_name_compare(curitem->name, cur->data)); cur = cur->next);
+ cur = purple_account_privacy_get_denied(account); + if (!g_slist_find_custom(cur, curitem->name, (GCompareFunc)oscar_util_name_compare)) { purple_debug_info("oscar",
"ssi: adding deny buddy %s to local list\n", curitem->name);
purple_account_privacy_deny_add(account, curitem->name, TRUE);
--- a/libpurple/protocols/oscar/oscar_data.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/oscar/oscar_data.c Wed Oct 16 01:06:17 2019 +0300
@@ -111,11 +111,7 @@
g_object_unref(od->http_conns);
- while (od->requesticon)
- g_free(od->requesticon->data);
- od->requesticon = g_slist_delete_link(od->requesticon, od->requesticon);
+ g_slist_free_full(od->requesticon, g_free); --- a/libpurple/protocols/oscar/tlv.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/oscar/tlv.c Wed Oct 16 01:06:17 2019 +0300
@@ -233,11 +233,7 @@
void aim_tlvlist_free(GSList *list)
- list = g_slist_delete_link(list, list);
+ g_slist_free_full(list, (GDestroyNotify)freetlv); @@ -248,16 +244,7 @@
int aim_tlvlist_count(GSList *list)
- for (cur = list, count = 0; cur; cur = cur->next)
+ return (int)g_slist_length(list); --- a/libpurple/protocols/simple/sipmsg.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/simple/sipmsg.c Wed Oct 16 01:06:17 2019 +0300
@@ -193,32 +193,21 @@
void sipmsg_remove_header(struct sipmsg *msg, const gchar *name) {
- struct siphdrelement *elem;
- GSList *tmp = msg->headers;
- if(g_ascii_strcasecmp(elem->name, name)==0) {
- msg->headers = g_slist_remove(msg->headers, elem);
- tmp = g_slist_next(tmp);
+ GSList *tmp = g_slist_find_custom(msg->headers, name, (GCompareFunc)g_ascii_strcasecmp); + struct siphdrelement *elem = tmp->data; + msg->headers = g_slist_remove(msg->headers, elem);
const gchar *sipmsg_find_header(struct sipmsg *msg, const gchar *name) {
- struct siphdrelement *elem;
- if(g_ascii_strcasecmp(elem->name, name)==0) {
- tmp = g_slist_next(tmp);
+ GSList *tmp = g_slist_find_custom(msg->headers, name, (GCompareFunc)g_ascii_strcasecmp); + struct siphdrelement *elem = tmp->data; --- a/libpurple/protocols/zephyr/zephyr.c Tue Oct 15 04:05:27 2019 +0000
+++ b/libpurple/protocols/zephyr/zephyr.c Wed Oct 16 01:06:17 2019 +0300
@@ -1982,7 +1982,6 @@
static void zephyr_close(PurpleConnection * gc)
zephyr_account *zephyr = purple_connection_get_protocol_data(gc);
pid_t tzc_pid = zephyr->tzc_pid;
@@ -1994,12 +1993,7 @@
if (purple_account_get_bool(purple_connection_get_account(gc), "write_zsubs", FALSE))
- free_triple((zephyr_triple *) s->data);
- g_slist_free(zephyr->subscrips);
+ g_slist_free_full(zephyr->subscrips, (GDestroyNotify)free_triple); g_source_remove(zephyr->nottimer);
@@ -2813,11 +2807,7 @@
static void zephyr_unregister_slash_commands(void)
- PurpleCmdId id = GPOINTER_TO_UINT(cmds->data);
- purple_cmd_unregister(id);
- cmds = g_slist_delete_link(cmds, cmds);
+ g_slist_free_full(cmds, (GDestroyNotify)purple_cmd_unregister); --- a/pidgin/plugins/spellchk.c Tue Oct 15 04:05:27 2019 +0000
+++ b/pidgin/plugins/spellchk.c Wed Oct 16 01:06:17 2019 +0300
@@ -2012,13 +2012,13 @@
*list = g_slist_prepend(*list, row_reference);
-static void remove_row(void *data1, gpointer data2)
+static void remove_row(void *data) GtkTreeRowReference *row_reference;
- row_reference = (GtkTreeRowReference *)data1;
+ row_reference = (GtkTreeRowReference *)data; path = gtk_tree_row_reference_get_path(row_reference);
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path))
@@ -2036,8 +2036,7 @@
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
gtk_tree_selection_selected_foreach(sel, add_selected_row_to_list, &list);
- g_slist_foreach(list, remove_row, NULL);
+ g_slist_free_full(list, remove_row);