ACK
--
Russell Bryant
On Mon, Jul 11, 2011 at 7:51 AM, Roman Rakus <rrakus(a)redhat.com> wrote:
If the function is missing (in older glib-2 libraries) use our
implementation. Copied from glib-2.29.8.
Signed-off-by: Roman Rakus <rrakus(a)redhat.com>
---
src/CMakeLists.txt | 8 ++++++--
src/include/config.h.in | 1 +
src/include/matahari/utilities.h | 10 ++++++++++
src/lib/utilities.c | 9 +++++++++
4 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a9ad3d1..e0a9914 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -42,8 +42,6 @@ check_include_files (resolv.h HAVE_RESOLV_H)
include (CheckFunctionExists)
check_function_exists (asprintf HAVE_ASPRINTF)
check_function_exists (time HAVE_TIME)
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/matahari.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/matahari.h)
if(NOT PKG_CONFIG_FOUND)
message("pkg-config not found")
@@ -80,6 +78,8 @@ if(NOT glib_FOUND)
message(FATAL_ERROR "Glib2 header/library not found.")
endif(NOT glib_FOUND)
include_directories(${glib_INCLUDE_DIRS})
+SET(CMAKE_REQUIRED_LIBRARIES ${glib_LIBRARIES})
+check_function_exists (g_list_free_full HAVE_G_LIST_FREE_FULL)
# Include QMF and DBus generation macros
include(MatahariMacros)
@@ -156,3 +156,7 @@ if(WITH-DBUS)
install(FILES include/matahari/mh_dbus_common.h DESTINATION include/matahari)
install(FILES include/matahari/mh_gobject_class.h DESTINATION include/matahari)
endif(WITH-DBUS)
+
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/matahari.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/matahari.h)
+
diff --git a/src/include/config.h.in b/src/include/config.h.in
index 4a2ff46..9253178 100644
--- a/src/include/config.h.in
+++ b/src/include/config.h.in
@@ -3,3 +3,4 @@
#cmakedefine HAVE_ASPRINTF 1
#cmakedefine HAVE_RESOLV_H 1
#cmakedefine HAVE_TIME 1
+#cmakedefine HAVE_G_LIST_FREE_FULL 1
diff --git a/src/include/matahari/utilities.h b/src/include/matahari/utilities.h
index 127f298..cf416a1 100644
--- a/src/include/matahari/utilities.h
+++ b/src/include/matahari/utilities.h
@@ -51,6 +51,16 @@ extern wchar_t *char2wide(const char *str);
extern int asprintf(char **ret, const char *fmt, ...);
#endif
+#ifndef HAVE_G_LIST_FREE_FULL
+/**
+ * Custom implementation of g_list_free_full()
+ *
+ * This version of g_list_free_full() is only used when the build system
+ * doesn't find g_list_free_full() on the system.
+ */
+extern void g_list_free_full(GList *list, GDestroyNotify free_func);
+#endif
+
#define DIMOF(a) ((int) (sizeof(a) / sizeof(0[a])))
#ifndef __GNUC__
diff --git a/src/lib/utilities.c b/src/lib/utilities.c
index 7047cff..96e98c7 100644
--- a/src/lib/utilities.c
+++ b/src/lib/utilities.c
@@ -452,3 +452,12 @@ asprintf(char **ret, const char *fmt, ...)
return len;
}
#endif /* HAVE_ASPRINTF */
+
+#ifndef HAVE_G_LIST_FREE_FULL
+void
+g_list_free_full (GList *list, GDestroyNotify free_func)
+{
+ g_list_foreach (list, (GFunc) free_func, NULL);
+ g_list_free (list);
+}
+#endif /* HAVE_G_LIST_FREE_FULL */
--
1.7.6
_______________________________________________
Matahari mailing list
Matahari(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/matahari