Port: Add glib g_mkdtemp to mkdtemp wrapper
[babeltrace.git] / 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.023855 seconds and 4 git commands to generate.