* http://www.ijs.si/software/snprintf/
*/
+/* find vasprintf in stdio.h */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+#include <stdio.h>
+
#include "xbt/sysdep.h" /* xbt_abort() */
#include "src/internal_config.h" /* Do we need vasprintf? */
-#include <stdio.h>
-#if !defined(HAVE_VASPRINTF)
+#include <assert.h>
+
+#if !HAVE_VASPRINTF
#include <stdarg.h> /* vsnprintf */
int vasprintf(char **ptr, const char *fmt, va_list ap);
int vasprintf(char **ptr, const char *fmt, va_list ap)
if (vasprintf(&res, fmt, ap) < 0) {
/* Do not want to use xbt_die() here, as it uses the logging
- * infrastucture and may fail to allocate memory too. */
+ * infrastructure and may fail to allocate memory too. */
fprintf(stderr, "bprintf: vasprintf failed. Aborting.\n");
xbt_abort();
}