From: Ken Raeburn Date: Wed, 27 Jun 2007 23:43:04 +0000 (+0000) Subject: For Win32 environment, define CAN_COPY_VA_LIST, and define an inline X-Git-Tag: krb5-1.7-alpha1~1047 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b145f6865824119c8c8d3341aac75980b8bae043;p=krb5.git For Win32 environment, define CAN_COPY_VA_LIST, and define an inline version of vsnprintf using the MS versions. (Apparently no need for plain snprintf just yet.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19644 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h index de1b698d5..b1b078108 100644 --- a/src/include/k5-platform.h +++ b/src/include/k5-platform.h @@ -48,6 +48,10 @@ #include #include +#ifdef _WIN32 +#define CAN_COPY_VA_LIST +#endif + /* Initialization and finalization function support for libraries. At top level, before the functions are defined or even declared: @@ -770,8 +774,24 @@ load_64_n (const unsigned char *p) /* Provide [v]asprintf interfaces. */ #ifndef HAVE_VSNPRINTF +#ifdef _WIN32 +static inline int +vsnprintf(char *str, size_t size, const char *format, va_list args) +{ + va_list args_copy; + int length; + + va_copy(args_copy, args); + length = _vscprintf(format, args_copy); + va_end(args_copy); + if (size) + _vsnprintf(str, size, format, args); + return length; +} +#else /* not win32 */ #error We need an implementation of vsnprintf. -#endif +#endif /* win32? */ +#endif /* no vsnprintf */ #ifndef HAVE_VASPRINTF #define vasprintf k5_vasprintf /* On error: BSD: Set *ret to NULL. GNU: *ret is undefined.