From: Michael Jeanson Date: Thu, 15 Sep 2016 16:14:43 +0000 (-0400) Subject: Port: Add glib g_mkdtemp to mkdtemp wrapper X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=9679ac43d9000ddb01cdaf1ea6980ccdfca583b9;p=deliverable%2Fbabeltrace.git Port: Add glib g_mkdtemp to mkdtemp wrapper Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- diff --git a/include/babeltrace/compat/stdlib.h b/include/babeltrace/compat/stdlib.h index 57f942d99..be0518f59 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 */