X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c06fbf3e711f990cc0838f68cc871aa8c5d0a388..b6e3f2b55742279bfb7deeb3b79cf56eb82740bb:/src/xbt/snprintf.c diff --git a/src/xbt/snprintf.c b/src/xbt/snprintf.c index 0d4fe9c69e..0dbbadbec4 100644 --- a/src/xbt/snprintf.c +++ b/src/xbt/snprintf.c @@ -1,4 +1,3 @@ -#include "gras_config.h" /* * snprintf.c - a portable implementation of snprintf @@ -281,7 +280,6 @@ */ - /* ============================================= */ /* NO USER SERVICABLE PARTS FOLLOWING THIS POINT */ /* ============================================= */ @@ -323,9 +321,12 @@ #include #include #include -#include "gras_config.h" /* to get a working stdarg.h */ + +#include "portable.h" /* to get a working stdarg.h */ + #include #include +#include "xbt/str.h" #ifdef isdigit #undef isdigit @@ -379,12 +380,14 @@ /* prototypes */ + #if defined(NEED_ASPRINTF) int asprintf (char **ptr, const char *fmt, /*args*/ ...); #endif -#if defined(NEED_VASPRINTF) +#if defined(NEED_VASPRINTF) int vasprintf (char **ptr, const char *fmt, va_list ap); #endif + #if defined(NEED_ASNPRINTF) int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...); #endif @@ -395,6 +398,12 @@ int vasnprintf (char **ptr, size_t str_m, const char *fmt, va_list ap); #if defined(HAVE_SNPRINTF) /* declare our portable snprintf routine under name portable_snprintf */ /* declare our portable vsnprintf routine under name portable_vsnprintf */ +# if defined(_MSC_VER) && (_MSC_VER >= 1400) +# define portable_snprintf _snprintf +# if !defined(NEED_SNPRINTF_ONLY) +# define portable_vsnprintf vsnprintf +# endif +# endif #else /* declare our portable routines under names snprintf and vsnprintf */ #define portable_snprintf snprintf @@ -1042,7 +1051,10 @@ char *bprintf(const char*fmt, ...) { char *res; va_start(ap, fmt); - vasprintf(&res,fmt,ap); + + + vasprintf(&res,fmt,ap); + va_end(ap); return res; }