From 9679ac43d9000ddb01cdaf1ea6980ccdfca583b9 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Thu, 15 Sep 2016 12:14:43 -0400 Subject: [PATCH] Port: Add glib g_mkdtemp to mkdtemp wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- 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 57f942d9..be0518f5 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 #include +#include #ifdef HAVE_MKDTEMP + static inline char *bt_mkdtemp(char *template) { return mkdtemp(template); } + +#elif GLIB_CHECK_VERSION(2,30,0) + +#include +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.34.1