From d1f46ceb67d9da6878512fb42360f612cc190afa Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sun, 9 Jun 2019 14:00:11 +0200 Subject: [PATCH] Support ancient glib Thanks to @halftux Closes #501. --- tgp-utils.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tgp-utils.c b/tgp-utils.c index 0b5e15a..153ea8e 100644 --- a/tgp-utils.c +++ b/tgp-utils.c @@ -92,11 +92,20 @@ void tgp_g_queue_free_full (GQueue *queue, GDestroyNotify free_func) { g_queue_free (queue); } +#if GLIB_CHECK_VERSION(2,28,0) void tgp_g_list_free_full (GList *list, GDestroyNotify free_func) { if (list) { g_list_free_full (list, free_func); } } +#else +void tgp_g_list_free_full (GList *list, GDestroyNotify free_func) { + if (list) { + g_list_foreach (list, (GFunc)free_func, NULL); + g_list_free (list); + } +} +#endif const char *tgp_mime_to_filetype (const char *mime) { int len = (int) strlen (mime);