[lttng-dev] [PATCH babeltrace 3/3] Port: Add glib g_mkdtemp to mkdtemp wrapper
Michael Jeanson
mjeanson at efficios.com
Thu Sep 15 16:14:43 UTC 2016
Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
---
include/babeltrace/compat/stdlib.h | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/include/babeltrace/compat/stdlib.h b/include/babeltrace/compat/stdlib.h
index 57f942d..be0518f 100644
--- a/include/babeltrace/compat/stdlib.h
+++ b/include/babeltrace/compat/stdlib.h
@@ -25,16 +25,34 @@
* 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 */
--
2.7.4
More information about the lttng-dev
mailing list