X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/bc48db087894fd960073b3120cebf90e6b2f8c02..2738598c9f876339ee6f8b3fc217984b7b837539:/src/xbt/snprintf.c diff --git a/src/xbt/snprintf.c b/src/xbt/snprintf.c index 4f75d19f2f..bf85795443 100644 --- a/src/xbt/snprintf.c +++ b/src/xbt/snprintf.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2005-2010, 2012-2016. The SimGrid Team. +/* Copyright (c) 2005-2019. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -27,14 +27,14 @@ * If not, I'll be glad to provide one. * * FEATURES - * - careful adherence to specs regarding flags, field width and precision; + * - careful adherence to specs regarding flags, field width and precision * - good performance for large string handling (large format, large * argument or large paddings). Performance is similar to system's sprintf * and in several cases significantly better (make sure you compile with * optimizations turned on, tell the compiler the code is strict ANSI - * if necessary to give it more freedom for optimizations); - * - return value semantics per ISO/IEC 9899:1999 ("ISO C99"); - * - written in standard ISO/ANSI C - requires an ANSI C compiler. + * if necessary to give it more freedom for optimizations) + * - return value semantics per ISO/IEC 9899:1999 ("ISO C99") + * - written in standard ISO/ANSI C - requires an ANSI C compiler * * [...] * @@ -49,9 +49,15 @@ * http://www.ijs.si/software/snprintf/ */ +/* find vasprintf in stdio.h */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif +#include + #include "xbt/sysdep.h" /* xbt_abort() */ #include "src/internal_config.h" /* Do we need vasprintf? */ -#include + #include #if !HAVE_VASPRINTF @@ -85,7 +91,7 @@ char *bvprintf(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(); }