X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ca5481b0df20495a91c1e8689c4393e365f76322..0c2dd51124cc3f46d60aee55a43b5da17cf33d2a:/src/xbt/snprintf.c?ds=sidebyside diff --git a/src/xbt/snprintf.c b/src/xbt/snprintf.c index bca5ec2dea..526fc95817 100644 --- a/src/xbt/snprintf.c +++ b/src/xbt/snprintf.c @@ -58,9 +58,8 @@ #include "xbt/sysdep.h" /* xbt_abort() */ #include "src/internal_config.h" /* Do we need vasprintf? */ -#include - #if !HAVE_VASPRINTF +#include #include /* vsnprintf */ int vasprintf(char **ptr, const char *fmt, va_list ap); int vasprintf(char **ptr, const char *fmt, va_list ap) @@ -75,8 +74,9 @@ int vasprintf(char **ptr, const char *fmt, va_list ap) str_l = vsnprintf(NULL, (size_t) 0, fmt, ap2); /*get required size */ va_end(ap2); } - xbt_assert(str_l >= 0); /* possible integer overflow if str_m > INT_MAX */ - *ptr = (char *) xbt_malloc(str_m = (size_t) str_l + 1); + assert(str_l >= 0); /* possible integer overflow if str_m > INT_MAX */ + *ptr = (char*)malloc(str_m = (size_t)str_l + 1); + assert(*ptr != NULL); int str_l2 = vsnprintf(*ptr, str_m, fmt, ap); assert(str_l2 == str_l);