1965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes/*
2965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * Copyright (c) 1994, 1995, 1996
3965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *	The Regents of the University of California.  All rights reserved.
4965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *
5965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * Redistribution and use in source and binary forms, with or without
6965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * modification, are permitted provided that the following conditions
7965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * are met:
8965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * 1. Redistributions of source code must retain the above copyright
9965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *    notice, this list of conditions and the following disclaimer.
10965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * 2. Redistributions in binary form must reproduce the above copyright
11965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *    notice, this list of conditions and the following disclaimer in the
12965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *    documentation and/or other materials provided with the distribution.
13965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * 3. All advertising materials mentioning features or use of this software
14965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *    must display the following acknowledgement:
15965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *	This product includes software developed by the Computer Systems
16965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *	Engineering Group at Lawrence Berkeley Laboratory.
17965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * 4. Neither the name of the University nor of the Laboratory may be used
18965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *    to endorse or promote products derived from this software without
19965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *    specific prior written permission.
20965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *
21965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * SUCH DAMAGE.
32965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes */
33965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
34965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#ifndef portability_h
35965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#define	portability_h
36965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
37965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes/*
38965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * Helpers for portability between Windows and UN*X and between different
39965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * flavors of UN*X.
40965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes */
41965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
42965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#ifdef __cplusplus
43965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughesextern "C" {
44965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif
45965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
46965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#ifndef HAVE_STRLCPY
47965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes /*
48965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  * Macro that does the same thing as strlcpy().
49965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  */
50965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes #ifdef _MSC_VER
51965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  /*
52965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   * strncpy_s() is supported at least back to Visual
53965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   * Studio 2005.
54965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   */
55965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #define strlcpy(x, y, z) \
56965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes	strncpy_s((x), (z), (y), _TRUNCATE)
57965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
58965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes #else
59965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #define strlcpy(x, y, z) \
60965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes	(strncpy((x), (y), (z)), \
61965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes	 ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')), \
62965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes	 (void) strlen((y)))
63965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes #endif
64965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif
65965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
66965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes/*
67965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * For flagging arguments as format strings in MSVC.
68965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes */
69965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#if _MSC_VER >= 1400
70965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes #include <sal.h>
71965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes #if _MSC_VER > 1400
72965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #define FORMAT_STRING(p) _Printf_format_string_ p
73965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes #else
74965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #define FORMAT_STRING(p) __format_string p
75965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes #endif
76965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#else
77965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes #define FORMAT_STRING(p) p
78965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif
79965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
80965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#ifdef _MSC_VER
81965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #define strdup	_strdup
82965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #define sscanf	sscanf_s
83965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #define setbuf(x, y) \
84965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes	setvbuf((x), (y), _IONBF, 0)
85965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #define fopen(x, y) \
86965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes	fopen_safe((x), (y))
87965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  FILE *fopen_safe(const char *filename, const char* mode);
88965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif
89965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
90965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#if defined(_MSC_VER) || defined(__MINGW32__)
91965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #define strlcat(x, y, z) \
92965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes	strncat_s((x), (z), (y), _TRUNCATE)
93965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif
94965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
95965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#ifdef _MSC_VER
96965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  /*
97965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   * MSVC.
98965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   */
99965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #if _MSC_VER >= 1900
100965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    /*
101965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes     * VS 2015 or newer; we have snprintf() function.
102965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes     */
103965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #define HAVE_SNPRINTF
104965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #endif
105965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif
106965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
107965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes/*
108965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * On Windows, snprintf(), with that name and with C99 behavior - i.e.,
109965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * guaranteeing that the formatted string is null-terminated - didn't
110965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * appear until Visual Studio 2015.  Prior to that, the C runtime had
111965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * only _snprintf(), which *doesn't* guarantee that the string is
112965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * null-terminated if it is truncated due to the buffer being too
113965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * small.  We therefore can't just define snprintf to be _snprintf
114965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * and define vsnprintf to be _vsnprintf, as we're relying on null-
115965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * termination of strings in all cases.
116965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *
117965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * We also want to allow this to be built with versions of Visual Studio
118965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * prior to VS 2015, so we can't rely on snprintf() being present.
119965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *
120965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * And we want to make sure that, if we support plugins in the future,
121965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * a routine with C99 snprintf() behavior will be available to them.
122965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * We also don't want it to collide with the C library snprintf() if
123965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * there is one.
124965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes *
125965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * So we make pcap_snprintf() and pcap_vsnprintf() available, either by
126965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * #defining them to be snprintf or vsnprintf, respectively, or by
127965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes * defining our own versions and exporting them.
128965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes */
129965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#ifdef HAVE_SNPRINTF
130965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#define pcap_snprintf snprintf
131965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#else
132965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughesextern int pcap_snprintf(char *, size_t, FORMAT_STRING(const char *), ...)
133965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#ifdef __ATTRIBUTE___FORMAT_OK
134965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    __attribute__((format (printf, 3, 4)))
135965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif /* __ATTRIBUTE___FORMAT_OK */
136965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    ;
137965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif
138965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
139965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#ifdef HAVE_VSNPRINTF
140965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#define pcap_vsnprintf vsnprintf
141965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#else
142965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughesextern int pcap_vsnprintf(char *, size_t, const char *, va_list ap);
143965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif
144965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
145965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#ifdef HAVE_STRTOK_R
146965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #define pcap_strtok_r	strtok_r
147965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#else
148965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #ifdef _MSC_VER
149965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    /*
150965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes     * Microsoft gives it a different name.
151965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes     */
152965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #define pcap_strtok_r	strtok_s
153965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #else
154965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    /*
155965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes     * Define it ourselves.
156965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes     */
157965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #define NEED_STRTOK_R
158965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    extern int pcap_strtok_r(char *, const char *, char **);
159965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #endif
160965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif /* HAVE_STRTOK_R */
161965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
162965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#ifdef _WIN32
163965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  /*
164965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   * These may be defined by <inttypes.h>.
165965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   *
166965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   * XXX - for MSVC, we always want the _MSC_EXTENSIONS versions.
167965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   * What about other compilers?  If, as the MinGW Web site says MinGW
168965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   * does, the other compilers just use Microsoft's run-time library,
169965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   * then they should probably use the _MSC_EXTENSIONS even if the
170965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   * compiler doesn't define _MSC_EXTENSIONS.
171965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   *
172965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   * XXX - we currently aren't using any of these, but this allows
173965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   * their use in the future.
174965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes   */
175965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #ifndef PRId64
176965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #ifdef _MSC_EXTENSIONS
177965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes      #define PRId64	"I64d"
178965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #else
179965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes      #define PRId64	"lld"
180965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #endif
181965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #endif /* PRId64 */
182965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
183965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #ifndef PRIo64
184965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #ifdef _MSC_EXTENSIONS
185965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes      #define PRIo64	"I64o"
186965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #else
187965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes      #define PRIo64	"llo"
188965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #endif
189965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #endif /* PRIo64 */
190965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
191965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #ifndef PRIx64
192965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #ifdef _MSC_EXTENSIONS
193965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes      #define PRIx64	"I64x"
194965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #else
195965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes      #define PRIx64	"llx"
196965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #endif
197965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #endif
198965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
199965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #ifndef PRIu64
200965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #ifdef _MSC_EXTENSIONS
201965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes      #define PRIu64	"I64u"
202965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #else
203965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes      #define PRIu64	"llu"
204965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #endif
205965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #endif
206965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
207965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #if !defined(__cplusplus)
208965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes    #define inline __inline
209965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes  #endif
210965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif /* _WIN32 */
211965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
212965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#ifdef __cplusplus
213965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes}
214965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif
215965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes
216965a4b5291eead2d8f826d2c87e58a12bb56a214Elliott Hughes#endif
217