1 #ifndef __snprintf_compat_h
2 #define __snprintf_compat_h
6 * @brief Do not use, json-c internal, may be changed or removed at any time.
10 * Microsoft's _vsnprintf and _snprint don't always terminate
11 * the string, so use wrappers that ensure that.
16 #if !defined(HAVE_SNPRINTF) && (defined(_MSC_VER) || defined(__MINGW32__))
17 static int json_c_vsnprintf(char *str, size_t size, const char *format, va_list ap)
20 ret = _vsnprintf(str, size, format, ap);
24 #define vsnprintf json_c_vsnprintf
26 static int json_c_snprintf(char *str, size_t size, const char *format, ...)
31 ret = json_c_vsnprintf(str, size, format, ap);
35 #define snprintf json_c_snprintf
37 #elif !defined(HAVE_SNPRINTF) /* !HAVE_SNPRINTF */
38 #error Need vsnprintf!
39 #endif /* !HAVE_SNPRINTF && defined(WIN32) */
41 #endif /* __snprintf_compat_h */