Port: Add glib g_mkdtemp to mkdtemp wrapper
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 15 Sep 2016 16:14:43 +0000 (12:14 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 26 May 2017 14:06:29 +0000 (10:06 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/compat/stdlib.h

index 57f942d9921ce2412d4b60479dc0108627f31f45..be0518f5920455375118312f481703d8cd842469 100644 (file)
  * SOFTWARE.
  */
 
+/*
+ * This compat wrapper can be removed and replaced by g_mkdtemp() when we bump
+ * the requirement on glib to version 2.30.
+ */
+
 #include <stdlib.h>
 #include <sys/stat.h>
+#include <glib.h>
 
 #ifdef HAVE_MKDTEMP
+
 static inline
 char *bt_mkdtemp(char *template)
 {
        return mkdtemp(template);
 }
+
+#elif GLIB_CHECK_VERSION(2,30,0)
+
+#include <glib/gstdio.h>
+static inline
+char *bt_mkdtemp(char *template)
+{
+       return g_mkdtemp(template);
+}
+
 #else
+
 static inline
 char *bt_mkdtemp(char *template)
 {
@@ -54,7 +72,7 @@ char *bt_mkdtemp(char *template)
 end:
        return ret;
 }
-#endif
 
+#endif
 
 #endif /* _BABELTRACE_COMPAT_STDLIB_H */
This page took 0.02555 seconds and 4 git commands to generate.