abrt/Decommission-libreport_list_free_with_free.patch

144 lines
5.8 KiB
Diff
Raw Normal View History

2022-01-08 15:59:34 +08:00
From 94dc256644a82f2777cd1193cc0d1d3b5e8be10a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Grabovsk=C3=BD?= <mgrabovs@redhat.com>
Date: Thu, 13 Aug 2020 11:49:28 +0200
Subject: [PATCH] Decommission libreport_list_free_with_free
Follow-up to abrt/libreport#660
---
src/daemon/rpm.c | 5 ++---
src/dbus/abrt-dbus.c | 16 ++++++++--------
src/lib/kernel.c | 3 +--
src/plugins/abrt-action-trim-files.c | 2 +-
src/plugins/abrt-dump-oops.c | 3 +--
5 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/src/daemon/rpm.c b/src/daemon/rpm.c
index 9bbdaa516..af9ff63a1 100644
--- a/src/daemon/rpm.c
+++ b/src/daemon/rpm.c
@@ -63,7 +63,7 @@ void rpm_init()
error_msg("Can't read RPM rc files");
#endif
- libreport_list_free_with_free(list_fingerprints); /* paranoia */
+ g_list_free_full(list_fingerprints, free);
/* Huh? Why do we start the list with an element with NULL string? */
list_fingerprints = g_list_alloc();
}
@@ -77,8 +77,7 @@ void rpm_destroy()
#endif
#endif
- libreport_list_free_with_free(list_fingerprints);
- list_fingerprints = NULL;
+ g_list_free_full(g_steal_pointer(&list_fingerprints), free);
}
void rpm_load_gpgkey(const char* filename)
diff --git a/src/dbus/abrt-dbus.c b/src/dbus/abrt-dbus.c
index dc7ad75c2..0c5fd3308 100644
--- a/src/dbus/abrt-dbus.c
+++ b/src/dbus/abrt-dbus.c
@@ -390,7 +390,7 @@ static void handle_method_call(GDBusConnection *connection,
{
GList *dirs = get_problem_dirs_for_uid(caller_uid, abrt_g_settings_dump_location);
response = variant_from_string_list(dirs);
- libreport_list_free_with_free(dirs);
+ g_list_free_full(dirs, free);
g_dbus_method_invocation_return_value(invocation, response);
//I was told that g_dbus_method frees the response
@@ -411,10 +411,10 @@ static void handle_method_call(GDBusConnection *connection,
caller_uid = 0;
}
- GList * dirs = get_problem_dirs_for_uid(caller_uid, abrt_g_settings_dump_location);
+ GList *dirs = get_problem_dirs_for_uid(caller_uid, abrt_g_settings_dump_location);
response = variant_from_string_list(dirs);
- libreport_list_free_with_free(dirs);
+ g_list_free_full(dirs, free);
g_dbus_method_invocation_return_value(invocation, response);
return;
@@ -422,9 +422,9 @@ static void handle_method_call(GDBusConnection *connection,
if (g_strcmp0(method_name, "GetForeignProblems") == 0)
{
- GList * dirs = get_problem_dirs_not_accessible_by_uid(caller_uid, abrt_g_settings_dump_location);
+ GList *dirs = get_problem_dirs_not_accessible_by_uid(caller_uid, abrt_g_settings_dump_location);
response = variant_from_string_list(dirs);
- libreport_list_free_with_free(dirs);
+ g_list_free_full(dirs, free);
g_dbus_method_invocation_return_value(invocation, response);
return;
@@ -540,7 +540,7 @@ static void handle_method_call(GDBusConnection *connection,
g_variant_builder_add(builder, "{ss}", element_name, value);
}
}
- libreport_list_free_with_free(elements);
+ g_list_free_full(elements, free);
dd_close(dd);
/* It is OK to call g_variant_new("(a{ss})", NULL) because */
/* G_VARIANT_TYPE_TUPLE allows NULL value */
@@ -749,7 +749,7 @@ static void handle_method_call(GDBusConnection *connection,
g_dbus_method_invocation_return_value(invocation, NULL);
ret:
- libreport_list_free_with_free(problem_dirs);
+ g_list_free_full(problem_dirs, free);
return;
}
@@ -776,7 +776,7 @@ static void handle_method_call(GDBusConnection *connection,
GList *dirs = get_problem_dirs_for_element_in_time(caller_uid, element, value, timestamp_from,
timestamp_to);
response = variant_from_string_list(dirs);
- libreport_list_free_with_free(dirs);
+ g_list_free_full(dirs, free);
g_dbus_method_invocation_return_value(invocation, response);
return;
diff --git a/src/lib/kernel.c b/src/lib/kernel.c
index 758fe63dd..7c266a249 100644
--- a/src/lib/kernel.c
+++ b/src/lib/kernel.c
@@ -357,8 +357,7 @@ void abrt_koops_extract_oopses(GList **oops_list, char *buffer, size_t buflen)
free(lines_info);
lines_info = NULL;
lines_info_size = 0;
- libreport_list_free_with_free(*oops_list);
- *oops_list = NULL;
+ g_list_free_full(g_steal_pointer(oops_list), free);
}
goto next_line;
}
diff --git a/src/plugins/abrt-action-trim-files.c b/src/plugins/abrt-action-trim-files.c
index 4633a8d9a..5ab953dfe 100644
--- a/src/plugins/abrt-action-trim-files.c
+++ b/src/plugins/abrt-action-trim-files.c
@@ -179,7 +179,7 @@ static void delete_files(gpointer data, gpointer void_preserve_list)
if (cur_size <= cap_size || !worst_file_list)
{
- libreport_list_free_with_free(worst_file_list);
+ g_list_free_full(g_steal_pointer(&worst_file_list), free);
log_info("cur_size:%.0f cap_size:%.0f, no (more) trimming", cur_size, cap_size);
break;
}
diff --git a/src/plugins/abrt-dump-oops.c b/src/plugins/abrt-dump-oops.c
index f30b87bb6..0781b910c 100644
--- a/src/plugins/abrt-dump-oops.c
+++ b/src/plugins/abrt-dump-oops.c
@@ -196,8 +196,7 @@ int main(int argc, char **argv)
errors = abrt_oops_process_list(oops_list, dump_location,
ABRT_DUMP_OOPS_ANALYZER, oops_utils_flags);
- libreport_list_free_with_free(oops_list);
- //oops_list = NULL;
+ g_list_free_full(oops_list, free);
return errors;
}