diff options
| author | Ken Raeburn <raeburn@mit.edu> | 2007-06-27 23:43:04 +0000 |
|---|---|---|
| committer | Ken Raeburn <raeburn@mit.edu> | 2007-06-27 23:43:04 +0000 |
| commit | b145f6865824119c8c8d3341aac75980b8bae043 (patch) | |
| tree | a3cadc990c81813fa5ddb003a5e10d7ccf12cece /src/include | |
| parent | 181cca7b094f0ab7b9189462ae20dfeec3f1e1b5 (diff) | |
| download | krb5-b145f6865824119c8c8d3341aac75980b8bae043.tar.gz krb5-b145f6865824119c8c8d3341aac75980b8bae043.tar.xz krb5-b145f6865824119c8c8d3341aac75980b8bae043.zip | |
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
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/k5-platform.h | 22 |
1 files changed, 21 insertions, 1 deletions
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 <stdlib.h> #include <stdio.h> +#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. |
