]> granicus.if.org Git - icinga2/blob - third-party/hiredis/win32.h
Merge branch 'support/2.6'
[icinga2] / third-party / hiredis / win32.h
1 #ifndef _WIN32_HELPER_INCLUDE
2 #define _WIN32_HELPER_INCLUDE
3 #ifdef _MSC_VER
4
5 #ifndef inline
6 #define inline __inline
7 #endif
8
9 #ifndef va_copy
10 #define va_copy(d,s) ((d) = (s))
11 #endif
12
13 #ifndef snprintf
14 #define snprintf c99_snprintf
15
16 __inline int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap)
17 {
18     int count = -1;
19
20     if (size != 0)
21         count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
22     if (count == -1)
23         count = _vscprintf(format, ap);
24
25     return count;
26 }
27
28 __inline int c99_snprintf(char* str, size_t size, const char* format, ...)
29 {
30     int count;
31     va_list ap;
32
33     va_start(ap, format);
34     count = c99_vsnprintf(str, size, format, ap);
35     va_end(ap);
36
37     return count;
38 }
39 #endif
40
41 #endif
42 #endif