From d7d62ea5ee19f5cad52dcfb2f2a49d8d36fa1228 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 20 Jan 2011 18:34:08 +0100 Subject: introduce and use new helper function list_free_with_free Signed-off-by: Denys Vlasenko --- src/lib/Makefile.am | 1 + src/lib/abrt_dbus.c | 1 - src/lib/abrt_dbus.h | 1 - src/lib/glib_support.c | 26 ++++++++++++++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 src/lib/glib_support.c (limited to 'src/lib') diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 20fbd4ed..ce06795a 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -32,6 +32,7 @@ libreport_la_SOURCES = \ dirsize.c \ dump_dir.c \ get_cmdline.c \ + glib_support.c \ daemon_is_ok.c \ load_plugin_settings.c \ make_descr.c \ diff --git a/src/lib/abrt_dbus.c b/src/lib/abrt_dbus.c index 69ac1241..d1717636 100644 --- a/src/lib/abrt_dbus.c +++ b/src/lib/abrt_dbus.c @@ -17,7 +17,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include -#include #include "abrtlib.h" #include "abrt_dbus.h" diff --git a/src/lib/abrt_dbus.h b/src/lib/abrt_dbus.h index d8cc3aa8..2723555c 100644 --- a/src/lib/abrt_dbus.h +++ b/src/lib/abrt_dbus.h @@ -20,7 +20,6 @@ #define ABRT_DBUS_H #include -#include #include "abrtlib.h" diff --git a/src/lib/glib_support.c b/src/lib/glib_support.c new file mode 100644 index 00000000..feb4c18b --- /dev/null +++ b/src/lib/glib_support.c @@ -0,0 +1,26 @@ +/* + Copyright (C) 2011 ABRT team + Copyright (C) 2011 RedHat Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#include "abrtlib.h" + +void list_free_with_free(GList *list) +{ + for (GList *li = list; li; li = g_list_next(li)) + free(li->data); + g_list_free(list); +} -- cgit