about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-05-21 21:39:31 +0100
committerJames Booth <boothj5@gmail.com>2014-05-21 21:39:31 +0100
commitb3d49f2a3c48d9174e02341ce2f69ccd08a4c87c (patch)
tree2c89bfe6bfd13be67275abcdc0b545fb504c0aa0
parente1f4465dc7e92de0477fa805969c67c02dca32b5 (diff)
downloadprofani-tty-b3d49f2a3c48d9174e02341ce2f69ccd08a4c87c.tar.gz
Added backwards compatible g_list_free_full for glib < 2.28
-rw-r--r--src/common.c7
-rw-r--r--src/common.h2
-rw-r--r--src/config/account.c1
-rw-r--r--src/muc.c1
-rw-r--r--tests/test_cmd_bookmark.c1
5 files changed, 12 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c
index 4ad7f0bd..be2dd2bf 100644
--- a/src/common.c
+++ b/src/common.c
@@ -72,6 +72,13 @@ p_slist_free_full(GSList *items, GDestroyNotify free_func)
     g_slist_free (items);
 }
 
+void
+p_list_free_full(GList *items, GDestroyNotify free_func)
+{
+    g_list_foreach (items, (GFunc) free_func, NULL);
+    g_list_free (items);
+}
+
 gboolean
 create_dir(char *name)
 {
diff --git a/src/common.h b/src/common.h
index e6b0b267..48d6c97e 100644
--- a/src/common.h
+++ b/src/common.h
@@ -29,6 +29,7 @@
 
 #if !GLIB_CHECK_VERSION(2,28,0)
 #define g_slist_free_full(items, free_func)         p_slist_free_full(items, free_func)
+#define g_list_free_full(items, free_func)          p_list_free_full(items, free_func)
 #endif
 
 #if !GLIB_CHECK_VERSION(2,30,0)
@@ -72,6 +73,7 @@ typedef enum {
 
 gchar* p_utf8_substring(const gchar *str, glong start_pos, glong end_pos);
 void p_slist_free_full(GSList *items, GDestroyNotify free_func);
+void p_list_free_full(GList *items, GDestroyNotify free_func);
 gboolean create_dir(char *name);
 gboolean mkdir_recursive(const char *dir);
 char * str_replace(const char *string, const char *substr,
diff --git a/src/config/account.c b/src/config/account.c
index e019bf83..82e1a398 100644
--- a/src/config/account.c
+++ b/src/config/account.c
@@ -27,6 +27,7 @@
 
 #include "jid.h"
 #include "config/account.h"
+#include "common.h"
 
 ProfAccount*
 account_new(const gchar * const name, const gchar * const jid,
diff --git a/src/muc.c b/src/muc.c
index 369d19e1..3cf1f506 100644
--- a/src/muc.c
+++ b/src/muc.c
@@ -26,6 +26,7 @@
 #include <glib.h>
 
 #include "contact.h"
+#include "common.h"
 #include "jid.h"
 #include "tools/autocomplete.h"
 
diff --git a/tests/test_cmd_bookmark.c b/tests/test_cmd_bookmark.c
index 3a78ba5b..f576196c 100644
--- a/tests/test_cmd_bookmark.c
+++ b/tests/test_cmd_bookmark.c
@@ -12,6 +12,7 @@
 #include "xmpp/mock_xmpp.h"
 
 #include "muc.h"
+#include "common.h"
 
 #include "command/commands.h"