From 4dea5c2719e7555ab7c989e88d586fe6a25bfe5e Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sun, 14 Oct 2018 01:13:36 +0300 Subject: [PATCH] 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 --- src/osal.h | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/osal.h b/src/osal.h index e2da2611..e5c48f7c 100644 --- a/src/osal.h +++ b/src/osal.h @@ -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 #include @@ -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 */