Use g_[s]list_delete_link more.
This somewhat reverts some of your previous commits, but should work slightly better. We should have noticed this earlier, of course.
Testing Done:
Compile only, no scan-build.
Reviewed at https://reviews.imfreedom.org/r/715/
--- a/libpurple/dnsquery.c Wed Jun 02 04:11:03 2021 -0500
+++ b/libpurple/dnsquery.c Wed Jun 02 04:17:25 2021 -0500
@@ -115,12 +115,9 @@
- hosts = g_slist_remove(hosts, hosts->data);
- hosts = g_slist_remove(hosts, hosts->data);
+ hosts = g_slist_delete_link(hosts, hosts); + hosts = g_slist_delete_link(hosts, hosts); --- a/libpurple/dnssrv.c Wed Jun 02 04:11:03 2021 -0500
+++ b/libpurple/dnssrv.c Wed Jun 02 04:17:25 2021 -0500
@@ -472,8 +472,6 @@
write_to_parent(in, out, &size, sizeof(size));
write_to_parent(in, out, ret->data, sizeof(PurpleSrvResponse));
if (query.type == T_TXT) {
@@ -483,9 +481,8 @@
write_to_parent(in, out, response->content, l);
- ret = g_list_remove(ret, ret->data);
+ ret = g_list_delete_link(ret, ret); --- a/libpurple/protocols/bonjour/mdns_common.c Wed Jun 02 04:11:03 2021 -0500
+++ b/libpurple/protocols/bonjour/mdns_common.c Wed Jun 02 04:17:25 2021 -0500
@@ -141,8 +141,8 @@
- lst = g_slist_remove(lst, lst->data);
+ lst = g_slist_delete_link(lst, lst); --- a/libpurple/protocols/novell/nmuser.c Wed Jun 02 04:11:03 2021 -0500
+++ b/libpurple/protocols/novell/nmuser.c Wed Jun 02 04:17:25 2021 -0500
@@ -1525,9 +1525,8 @@
for (node = list; node; node = node->next) {
if (nm_utf8_str_equal(nm_user_record_get_dn(user_record),
(const char *) node->data)) {
- gpointer data = node->data;
- list = g_slist_remove(list, node->data);
+ list = g_slist_remove_link(list, node); nm_request_set_user_define(request, list);
--- a/libpurple/protocols/simple/simple.c Wed Jun 02 04:11:03 2021 -0500
+++ b/libpurple/protocols/simple/simple.c Wed Jun 02 04:17:25 2021 -0500
@@ -1803,7 +1803,6 @@
static void simple_udp_host_resolved(GSList *hosts, gpointer data, const char *error_message) {
struct simple_account_data *sip = (struct simple_account_data*) data;
@@ -1815,16 +1814,14 @@
addr_size = GPOINTER_TO_INT(hosts->data);
- hosts = g_slist_remove(hosts, hosts->data);
+ hosts = g_slist_delete_link(hosts, hosts); memcpy(&(sip->serveraddr), hosts->data, addr_size);
- hosts_data = hosts->data;
- hosts = g_slist_remove(hosts, hosts->data);
+ hosts = g_slist_delete_link(hosts, hosts); - hosts = g_slist_remove(hosts, hosts->data);
- hosts_data = hosts->data;
- hosts = g_slist_remove(hosts, hosts->data);
+ hosts = g_slist_delete_link(hosts, hosts); + hosts = g_slist_delete_link(hosts, hosts); /* create socket for incoming connections */
--- a/libpurple/proxy.c Wed Jun 02 04:11:03 2021 -0500
+++ b/libpurple/proxy.c Wed Jun 02 04:17:25 2021 -0500
@@ -579,14 +579,13 @@
while (connect_data->hosts != NULL)
/* Discard the length... */
- connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data);
+ connect_data->hosts = g_slist_delete_link(connect_data->hosts, /* Free the address... */
- data = connect_data->hosts->data;
- connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data);
+ g_free(connect_data->hosts->data); + connect_data->hosts = g_slist_delete_link(connect_data->hosts, g_free(connect_data->host);
--- a/libpurple/util.c Wed Jun 02 04:11:03 2021 -0500
+++ b/libpurple/util.c Wed Jun 02 04:17:25 2021 -0500
@@ -1479,7 +1479,6 @@
struct purple_parse_tag *pt = tags->data;
@@ -1501,9 +1500,8 @@
tags = g_list_remove(tags, pt);
- tags = g_list_remove(tags, tag->data);
+ tags = g_list_delete_link(tags, tag); /* a closing tag we weren't expecting...
* we'll let it slide, if it's really a tag...if it's
--- a/pidgin/gtkconv.c Wed Jun 02 04:11:03 2021 -0500
+++ b/pidgin/gtkconv.c Wed Jun 02 04:17:25 2021 -0500
@@ -4274,15 +4274,13 @@
addthis = g_strconcat(tmp, matches->data, " ", NULL);
- matches = g_list_remove(matches, matches->data);
+ matches = g_list_delete_link(matches, matches); purple_conversation_write(conv, NULL, addthis, PURPLE_MESSAGE_NO_LOG,