mdbx-windows: use _snprintf() and _vsnprintf() to avoid dependency from CRT.

8 of 17 for https://github.com/leo-yuriev/libmdbx/issues/43

Change-Id: I335a12344b0f0d63462ac4195fafdb60f981f182
This commit is contained in:
Leonid Yuriev 2018-10-14 01:13:36 +03:00
parent ded5269937
commit 4dea5c2719

View File

@ -94,6 +94,8 @@ static inline void *mdbx_realloc(void *ptr, size_t bytes) {
return LocalReAlloc(ptr, bytes, LMEM_MOVEABLE);
}
#define mdbx_free LocalFree
#define snprintf _snprintf /* ntdll */
#define vsnprintf _vsnprintf /* ntdll */
#else
#include <pthread.h>
#include <signal.h>
@ -401,20 +403,6 @@ __printf_args(2, 3) int mdbx_asprintf(char **strp, const char *fmt, ...);
int mdbx_vasprintf(char **strp, const char *fmt, va_list ap);
#endif
#ifdef _MSC_VER
#ifndef snprintf
#define snprintf(buffer, buffer_size, format, ...) \
_snprintf_s(buffer, buffer_size, _TRUNCATE, format, __VA_ARGS__)
#endif /* snprintf */
#ifndef vsnprintf
#define vsnprintf(buffer, buffer_size, format, args) \
_vsnprintf_s(buffer, buffer_size, _TRUNCATE, format, args)
#endif /* vsnprintf */
#endif /* _MSC_VER */
/*----------------------------------------------------------------------------*/
/* OS abstraction layer stuff */