diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index 2610aa8ec6..cc31972005 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,9 @@ +2010-04-14 Vincent Torri + + * src/lib/evil_stdio.c: + * src/lib/evil_stdio.h: + add vasprintf() function + 2010-04-03 Vincent Torri * src/lib/Evil.h: diff --git a/legacy/evil/src/lib/evil_stdio.c b/legacy/evil/src/lib/evil_stdio.c index 3e3aab8678..d859f52c40 100644 --- a/legacy/evil/src/lib/evil_stdio.c +++ b/legacy/evil/src/lib/evil_stdio.c @@ -214,3 +214,21 @@ int evil_fclose_native(FILE *stream) } #endif /* _WIN32_WCE */ + +#ifdef _MSC_VER + +int +vasprintf(char **strp, const char *fmt, va_list ap) +{ + char *res; + int len; + + len = _vsnprintf(NULL, 0, fmt, ap) + 1; + res = (char *)malloc(len); + if (!res) return -1; + + *strp = res; + return vsprintf(res, fmt, ap); +} + +#endif /* _MSC_VER */ diff --git a/legacy/evil/src/lib/evil_stdio.h b/legacy/evil/src/lib/evil_stdio.h index f56f85facd..626caac464 100644 --- a/legacy/evil/src/lib/evil_stdio.h +++ b/legacy/evil/src/lib/evil_stdio.h @@ -52,6 +52,12 @@ EAPI int evil_fclose_native(FILE *stream); #endif /* _WIN32_WCE */ +#ifdef _MSC_VER + +EAPI int vasprintf(char **strp, const char *fmt, va_list ap); + +#endif /* _MSC_VER */ + /** * @}