include/SDL_stdinc.h
changeset 8477 ad08f0d710f3
parent 8464 a2a909304cfe
parent 7386 ff3af8304053
child 8478 337b5dc0797b
     1.1 --- a/include/SDL_stdinc.h	Sat Jun 08 14:34:09 2013 -0400
     1.2 +++ b/include/SDL_stdinc.h	Mon Aug 12 22:29:55 2013 -0400
     1.3 @@ -21,7 +21,7 @@
     1.4  
     1.5  /**
     1.6   *  \file SDL_stdinc.h
     1.7 - *  
     1.8 + *
     1.9   *  This is a general header that includes C language support.
    1.10   */
    1.11  
    1.12 @@ -87,12 +87,12 @@
    1.13  /**
    1.14   *  The number of elements in an array.
    1.15   */
    1.16 -#define SDL_arraysize(array)	(sizeof(array)/sizeof(array[0]))
    1.17 -#define SDL_TABLESIZE(table)	SDL_arraysize(table)
    1.18 +#define SDL_arraysize(array)    (sizeof(array)/sizeof(array[0]))
    1.19 +#define SDL_TABLESIZE(table)    SDL_arraysize(table)
    1.20  
    1.21  /**
    1.22   *  \name Cast operators
    1.23 - *  
    1.24 + *
    1.25   *  Use proper C++ casts when compiled as C++ to be compatible with the option
    1.26   *  -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
    1.27   */
    1.28 @@ -186,7 +186,7 @@
    1.29  
    1.30  /** \cond */
    1.31  #ifndef DOXYGEN_SHOULD_IGNORE_THIS
    1.32 -#if !defined(__ANDROID__) 
    1.33 +#if !defined(__ANDROID__)
    1.34     /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
    1.35  typedef enum
    1.36  {
    1.37 @@ -201,9 +201,7 @@
    1.38  #include "begin_code.h"
    1.39  /* Set up for C function definitions, even when using C++ */
    1.40  #ifdef __cplusplus
    1.41 -/* *INDENT-OFF* */
    1.42  extern "C" {
    1.43 -/* *INDENT-ON* */
    1.44  #endif
    1.45  
    1.46  #if defined(HAVE_ALLOCA) && !defined(alloca)
    1.47 @@ -236,71 +234,17 @@
    1.48  #define SDL_stack_free(data)            SDL_free(data)
    1.49  #endif
    1.50  
    1.51 -
    1.52 -/* SDL stdinc inline functions:
    1.53 -
    1.54 -   The theory here is that by default we forcibly inline what we can, and your
    1.55 -   app will use the inline version by default. However we expose a non-inline
    1.56 -   version too, so the symbol is always available in the library even if your app
    1.57 -   bypassed the inline version. The SDL_*_inline versions aren't guaranteed to
    1.58 -   exist, so never call them directly; use SDL_* instead, and trust the system
    1.59 -   to give you the right thing.
    1.60 -
    1.61 -   The benefit here is that you can dlsym() these functions, which you
    1.62 -   couldn't if you had macros, you can link against a foreign build of SDL
    1.63 -   even if you configured differently, and you can drop the unconfigured SDL
    1.64 -   headers into a project without #defining HAVE_MALLOC (etc) and still link.
    1.65 -*/
    1.66 -
    1.67  extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
    1.68 -#ifdef HAVE_MALLOC
    1.69 -SDL_FORCE_INLINE void *SDL_malloc_inline(size_t size) { return malloc(size); }
    1.70 -#define SDL_malloc SDL_malloc_inline
    1.71 -#endif
    1.72 -
    1.73  extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
    1.74 -#ifdef HAVE_CALLOC
    1.75 -SDL_FORCE_INLINE void *SDL_calloc_inline(size_t nmemb, size_t size) { return calloc(nmemb, size); }
    1.76 -#define SDL_calloc SDL_calloc_inline
    1.77 -#endif
    1.78 -
    1.79  extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
    1.80 -#ifdef HAVE_REALLOC
    1.81 -SDL_FORCE_INLINE void *SDL_realloc_inline(void *mem, size_t size) { return realloc(mem, size); }
    1.82 -#define SDL_realloc SDL_realloc_inline
    1.83 -#endif
    1.84 -
    1.85  extern DECLSPEC void SDLCALL SDL_free(void *mem);
    1.86 -#ifdef HAVE_FREE
    1.87 -SDL_FORCE_INLINE void SDL_free_inline(void *mem) { free(mem); }
    1.88 -#define SDL_free SDL_free_inline
    1.89 -#endif
    1.90  
    1.91  extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
    1.92 -#ifdef HAVE_GETENV
    1.93 -SDL_FORCE_INLINE char *SDL_getenv_inline(const char *name) { return getenv(name); }
    1.94 -#define SDL_getenv SDL_getenv_inline
    1.95 -#endif
    1.96 -
    1.97  extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
    1.98 -#ifdef HAVE_SETENV
    1.99 -SDL_FORCE_INLINE int SDL_setenv_inline(const char *name, const char *value, int overwrite) { return setenv(name, value, overwrite); }
   1.100 -#define SDL_setenv SDL_setenv_inline
   1.101 -#endif
   1.102  
   1.103  extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
   1.104 -#ifdef HAVE_QSORT
   1.105 -SDL_FORCE_INLINE void SDL_qsort_inline(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) { qsort(base, nmemb, size, compare); }
   1.106 -#define SDL_qsort SDL_qsort_inline
   1.107 -#endif
   1.108  
   1.109  extern DECLSPEC int SDLCALL SDL_abs(int x);
   1.110 -#ifdef HAVE_ABS
   1.111 -SDL_FORCE_INLINE int SDL_abs_inline(int x) { return abs(x); }
   1.112 -#else
   1.113 -SDL_FORCE_INLINE int SDL_abs_inline(int x) { return ((x) < 0 ? -(x) : (x)); }
   1.114 -#endif
   1.115 -#define SDL_abs SDL_abs_inline
   1.116  
   1.117  /* !!! FIXME: these have side effects. You probably shouldn't use them. */
   1.118  /* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */
   1.119 @@ -311,33 +255,14 @@
   1.120  extern DECLSPEC int SDLCALL SDL_isspace(int x);
   1.121  extern DECLSPEC int SDLCALL SDL_toupper(int x);
   1.122  extern DECLSPEC int SDLCALL SDL_tolower(int x);
   1.123 -#ifdef HAVE_CTYPE_H
   1.124 -SDL_FORCE_INLINE int SDL_isdigit_inline(int x) { return isdigit(x); }
   1.125 -SDL_FORCE_INLINE int SDL_isspace_inline(int x) { return isspace(x); }
   1.126 -SDL_FORCE_INLINE int SDL_toupper_inline(int x) { return toupper(x); }
   1.127 -SDL_FORCE_INLINE int SDL_tolower_inline(int x) { return tolower(x); }
   1.128 -#else
   1.129 -SDL_FORCE_INLINE int SDL_isdigit_inline(int x) { return ((x) >= '0') && ((x) <= '9'); }
   1.130 -SDL_FORCE_INLINE int SDL_isspace_inline(int x) { return ((x) == ' ') || ((x) == '\t') || ((x) == '\r') || ((x) == '\n'); }
   1.131 -SDL_FORCE_INLINE int SDL_toupper_inline(int x) { return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) : (x); }
   1.132 -SDL_FORCE_INLINE int SDL_tolower_inline(int x) { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); }
   1.133 -#endif
   1.134 -#define SDL_isdigit SDL_isdigit_inline
   1.135 -#define SDL_isspace SDL_isspace_inline
   1.136 -#define SDL_toupper SDL_toupper_inline
   1.137 -#define SDL_tolower SDL_tolower_inline
   1.138  
   1.139  extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len);
   1.140 -#ifdef HAVE_MEMSET
   1.141 -SDL_FORCE_INLINE void *SDL_memset_inline(void *dst, int c, size_t len) { return memset(dst, c, len); }
   1.142 -#define SDL_memset SDL_memset_inline
   1.143 -#endif
   1.144  
   1.145  #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
   1.146  #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
   1.147  
   1.148 -/* !!! FIXME: does this _really_ beat memset() on any modern platform? */
   1.149 -SDL_FORCE_INLINE void SDL_memset4(void *dst, int val, size_t len)
   1.150 +/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
   1.151 +SDL_FORCE_INLINE void SDL_memset4(void *dst, int val, size_t dwords)
   1.152  {
   1.153  #if defined(__GNUC__) && defined(i386)
   1.154      int u0, u1, u2;
   1.155 @@ -345,17 +270,16 @@
   1.156          "cld \n\t"
   1.157          "rep ; stosl \n\t"
   1.158          : "=&D" (u0), "=&a" (u1), "=&c" (u2)
   1.159 -        : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len))
   1.160 +        : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
   1.161          : "memory"
   1.162      );
   1.163 -/* !!! FIXME: amd64? */
   1.164  #else
   1.165 -    size_t _n = (len + 3) / 4;
   1.166 +    size_t _n = (dwords + 3) / 4;
   1.167      Uint32 *_p = SDL_static_cast(Uint32 *, dst);
   1.168      Uint32 _val = (val);
   1.169 -    if (len == 0)
   1.170 +    if (dwords == 0)
   1.171          return;
   1.172 -    switch (len % 4)
   1.173 +    switch (dwords % 4)
   1.174      {
   1.175          case 0: do {    *_p++ = _val;
   1.176          case 3:         *_p++ = _val;
   1.177 @@ -368,305 +292,54 @@
   1.178  
   1.179  
   1.180  extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
   1.181 -#if defined(__MACOSX__)
   1.182 -SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
   1.183 -{
   1.184 -    /* We can count on memcpy existing on Mac OS X and being well-tuned. */
   1.185 -    return memcpy(dst, src, len);
   1.186 -}
   1.187 -#define SDL_memcpy SDL_memcpy_inline
   1.188 -#elif defined(__GNUC__) && defined(i386) && !defined(__WIN32__)
   1.189 -SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
   1.190 -{
   1.191 -    /* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */
   1.192 -    /* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */
   1.193 -    /* !!! FIXME: amd64? */
   1.194 -    int u0, u1, u2;
   1.195 -    __asm__ __volatile__ (
   1.196 -        "cld \n\t"
   1.197 -        "rep ; movsl \n\t"
   1.198 -        "testb $2,%b4 \n\t"
   1.199 -        "je 1f \n\t"
   1.200 -        "movsw \n"
   1.201 -        "1:\ttestb $1,%b4 \n\t"
   1.202 -        "je 2f \n\t"
   1.203 -        "movsb \n"
   1.204 -        "2:"
   1.205 -        : "=&c" (u0), "=&D" (u1), "=&S" (u2)
   1.206 -        : "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst), "2" (src)
   1.207 -        : "memory"
   1.208 -    );
   1.209 -    return dst;
   1.210 -}
   1.211 -#define SDL_memcpy SDL_memcpy_inline
   1.212 -#elif defined(HAVE_MEMCPY)
   1.213 -SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
   1.214 -{
   1.215 -    return memcpy(dst, src, len);
   1.216 -}
   1.217 -#define SDL_memcpy SDL_memcpy_inline
   1.218 -#elif defined(HAVE_BCOPY)  /* !!! FIXME: is there _really_ ever a time where you have bcopy and not memcpy? */
   1.219 -SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
   1.220 -{
   1.221 -    bcopy(src, dst, len);
   1.222 -    return dst;
   1.223 -}
   1.224 -#define SDL_memcpy SDL_memcpy_inline
   1.225 -#endif
   1.226 -
   1.227  
   1.228  SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords)
   1.229  {
   1.230 -#if defined(__GNUC__) && defined(i386)
   1.231 -    /* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */
   1.232 -    /* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */
   1.233 -    int ecx, edi, esi;
   1.234 -    __asm__ __volatile__ (
   1.235 -        "cld \n\t"
   1.236 -        "rep ; movsl \n\t"
   1.237 -        : "=&c" (ecx), "=&D" (edi), "=&S" (esi)
   1.238 -        : "0" (SDL_static_cast(unsigned, dwords)), "1" (dst), "2" (src)
   1.239 -        : "memory"
   1.240 -    );
   1.241 -    return dst;
   1.242 -#else
   1.243      return SDL_memcpy(dst, src, dwords * 4);
   1.244 -#endif
   1.245  }
   1.246  
   1.247  extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src, size_t len);
   1.248 -#ifdef HAVE_MEMMOVE
   1.249 -SDL_FORCE_INLINE void *SDL_memmove_inline(void *dst, const void *src, size_t len) { return memmove(dst, src, len); }
   1.250 -#define SDL_memmove SDL_memmove_inline
   1.251 -#endif
   1.252 +extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
   1.253  
   1.254 -extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
   1.255 -#ifdef HAVE_MEMCMP
   1.256 -SDL_FORCE_INLINE int SDL_memcmp_inline(const void *s1, const void *s2, size_t len) { return memcmp(s1, s2, len); }
   1.257 -#define SDL_memcmp SDL_memcmp_inline
   1.258 -#endif
   1.259 +extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
   1.260 +extern DECLSPEC size_t SDLCALL SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen);
   1.261 +extern DECLSPEC size_t SDLCALL SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen);
   1.262  
   1.263  extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
   1.264 -#ifdef HAVE_STRLEN
   1.265 -SDL_FORCE_INLINE size_t SDL_strlen_inline(const char *str) { return strlen(str); }
   1.266 -#define SDL_strlen SDL_strlen_inline
   1.267 -#endif
   1.268 -
   1.269 -extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
   1.270 -#ifdef HAVE_WCSLEN
   1.271 -SDL_FORCE_INLINE size_t SDL_wcslen_inline(const wchar_t *wstr) { return wcslen(wstr); }
   1.272 -#define SDL_wcslen SDL_wcslen_inline
   1.273 -#endif
   1.274 -
   1.275 -extern DECLSPEC size_t SDLCALL SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen);
   1.276 -#ifdef HAVE_WCSLCPY
   1.277 -SDL_FORCE_INLINE size_t SDL_wcslcpy_inline(wchar_t *dst, const wchar_t *src, size_t maxlen) { return wcslcpy(dst, src, maxlen); }
   1.278 -#define SDL_wcslcpy SDL_wcslcpy_inline
   1.279 -#endif
   1.280 -
   1.281 -extern DECLSPEC size_t SDLCALL SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen);
   1.282 -#ifdef HAVE_WCSLCAT
   1.283 -SDL_FORCE_INLINE size_t SDL_wcslcat_inline(wchar_t *dst, const wchar_t *src, size_t maxlen) { return wcslcat(dst, src, maxlen); }
   1.284 -#define SDL_wcslcat SDL_wcslcat_inline
   1.285 -#endif
   1.286 -
   1.287  extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen);
   1.288 -#ifdef HAVE_STRLCPY
   1.289 -SDL_FORCE_INLINE size_t SDL_strlcpy_inline(char *dst, const char *src, size_t maxlen) { return strlcpy(dst, src, maxlen); }
   1.290 -#define SDL_strlcpy SDL_strlcpy_inline
   1.291 -#else
   1.292 -#endif
   1.293 -
   1.294  extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes);
   1.295 -
   1.296  extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen);
   1.297 -#ifdef HAVE_STRLCAT
   1.298 -SDL_FORCE_INLINE size_t SDL_strlcat_inline(char *dst, const char *src, size_t maxlen) { return strlcat(dst, src, maxlen); }
   1.299 -#define SDL_strlcat SDL_strlcat_inline
   1.300 -#endif
   1.301 -
   1.302  extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
   1.303 -#ifdef HAVE_STRDUP
   1.304 -SDL_FORCE_INLINE char *SDL_strdup_inline(const char *str) { return strdup(str); }
   1.305 -#define SDL_strdup SDL_strdup_inline
   1.306 -#endif
   1.307 -
   1.308  extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
   1.309 -#ifdef HAVE__STRREV
   1.310 -SDL_FORCE_INLINE char *SDL_strrev_inline(char *str) { return _strrev(str); }
   1.311 -#define SDL_strrev SDL_strrev_inline
   1.312 -#endif
   1.313 -
   1.314  extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
   1.315 -#ifdef HAVE__STRUPR
   1.316 -SDL_FORCE_INLINE char *SDL_strupr_inline(char *str) { return _strupr(str); }
   1.317 -#define SDL_strupr SDL_strupr_inline
   1.318 -#endif
   1.319 -
   1.320  extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
   1.321 -#ifdef HAVE__STRLWR
   1.322 -SDL_FORCE_INLINE char *SDL_strlwr_inline(char *str) { return _strlwr(str); }
   1.323 -#define SDL_strlwr SDL_strlwr_inline
   1.324 -#endif
   1.325 -
   1.326  extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
   1.327 -#ifdef HAVE_STRCHR
   1.328 -SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return SDL_const_cast(char*,strchr(str, c)); }
   1.329 -#define SDL_strchr SDL_strchr_inline
   1.330 -#elif defined(HAVE_INDEX)  /* !!! FIXME: is there anywhere that has this but not strchr? */
   1.331 -SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return SDL_const_cast(char*,index(str, c)); }
   1.332 -#define SDL_strchr SDL_strchr_inline
   1.333 -#endif
   1.334 -
   1.335  extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
   1.336 -#ifdef HAVE_STRRCHR
   1.337 -SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return SDL_const_cast(char*,strrchr(str, c)); }
   1.338 -#define SDL_strrchr SDL_strrchr_inline
   1.339 -#elif defined(HAVE_RINDEX)  /* !!! FIXME: is there anywhere that has this but not strrchr? */
   1.340 -SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return SDL_const_cast(char*,rindex(str, c)); }
   1.341 -#define SDL_strrchr SDL_strrchr_inline
   1.342 -#endif
   1.343 -
   1.344  extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
   1.345 -#ifdef HAVE_STRSTR
   1.346 -SDL_FORCE_INLINE char *SDL_strstr_inline(const char *haystack, const char *needle) { return SDL_const_cast(char*,strstr(haystack, needle)); }
   1.347 -#define SDL_strstr SDL_strstr_inline
   1.348 -#endif
   1.349 -
   1.350 -extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
   1.351 -#ifdef HAVE__LTOA
   1.352 -SDL_FORCE_INLINE char *SDL_ltoa_inline(long value, char *str, int radix) { return _ltoa(value, str, radix); }
   1.353 -#define SDL_ltoa SDL_ltoa_inline
   1.354 -#endif
   1.355  
   1.356  extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
   1.357 -#ifdef HAVE_ITOA
   1.358 -SDL_FORCE_INLINE char *SDL_itoa_inline(int value, char *str, int radix) { return itoa(value, str, radix); }
   1.359 -#else
   1.360 -SDL_FORCE_INLINE char *SDL_itoa_inline(int value, char *str, int radix) { return SDL_ltoa((long)value, str, radix); }
   1.361 -#endif
   1.362 -#define SDL_itoa SDL_itoa_inline
   1.363 -
   1.364 +extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
   1.365 +extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
   1.366  extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
   1.367 -#ifdef HAVE__ULTOA
   1.368 -SDL_FORCE_INLINE char *SDL_ultoa_inline(unsigned long value, char *str, int radix) { return _ultoa(value, str, radix); }
   1.369 -#define SDL_ultoa SDL_ultoa_inline
   1.370 -#endif
   1.371 -
   1.372 -extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
   1.373 -#ifdef HAVE__UITOA
   1.374 -SDL_FORCE_INLINE char *SDL_uitoa_inline(unsigned int value, char *str, int radix) { return _uitoa(value, str, radix); }
   1.375 -#else
   1.376 -SDL_FORCE_INLINE char *SDL_uitoa_inline(unsigned int value, char *str, int radix) { return SDL_ultoa((unsigned long)value, str, radix); }
   1.377 -#endif
   1.378 -#define SDL_uitoa SDL_uitoa_inline
   1.379 -
   1.380 -
   1.381 -extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
   1.382 -#ifdef HAVE_STRTOL
   1.383 -SDL_FORCE_INLINE long SDL_strtol_inline(const char *str, char **endp, int base) { return strtol(str, endp, base); }
   1.384 -#define SDL_strtol SDL_strtol_inline
   1.385 -#endif
   1.386 -
   1.387 -extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
   1.388 -#ifdef HAVE_STRTOUL
   1.389 -SDL_FORCE_INLINE unsigned long SDLCALL SDL_strtoul_inline(const char *str, char **endp, int base) { return strtoul(str, endp, base); }
   1.390 -#define SDL_strtoul SDL_strtoul_inline
   1.391 -#endif
   1.392 -
   1.393  extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix);
   1.394 -#ifdef HAVE__I64TOA
   1.395 -SDL_FORCE_INLINE char *SDL_lltoa_inline(Sint64 value, char *str, int radix) { return _i64toa(value, str, radix); }
   1.396 -#define SDL_lltoa SDL_lltoa_inline
   1.397 -#endif
   1.398 -
   1.399  extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix);
   1.400 -#ifdef HAVE__UI64TOA
   1.401 -SDL_FORCE_INLINE char *SDL_ulltoa_inline(Uint64 value, char *str, int radix) { return _ui64toa(value, str, radix); }
   1.402 -#define SDL_ulltoa SDL_ulltoa_inline
   1.403 -#endif
   1.404 -
   1.405 -extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
   1.406 -#ifdef HAVE_STRTOLL
   1.407 -SDL_FORCE_INLINE Sint64 SDL_strtoll_inline(const char *str, char **endp, int base) { return strtoll(str, endp, base); }
   1.408 -#define SDL_strtoll SDL_strtoll_inline
   1.409 -#endif
   1.410 -
   1.411 -extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
   1.412 -#ifdef HAVE_STRTOULL
   1.413 -SDL_FORCE_INLINE Uint64 SDL_strtoull_inline(const char *str, char **endp, int base) { return strtoull(str, endp, base); }
   1.414 -#define SDL_strtoull SDL_strtoull_inline
   1.415 -#endif
   1.416 -
   1.417 -extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
   1.418 -#ifdef HAVE_STRTOD
   1.419 -SDL_FORCE_INLINE double SDL_strtod_inline(const char *str, char **endp) { return strtod(str, endp); }
   1.420 -#define SDL_strtod SDL_strtod_inline
   1.421 -#endif
   1.422  
   1.423  extern DECLSPEC int SDLCALL SDL_atoi(const char *str);
   1.424 -#ifdef HAVE_ATOI
   1.425 -SDL_FORCE_INLINE int SDL_atoi_inline(const char *str) { return atoi(str); }
   1.426 -#else
   1.427 -SDL_FORCE_INLINE int SDL_atoi_inline(const char *str) { return SDL_strtol(str, NULL, 0); }
   1.428 -#endif
   1.429 -#define SDL_atoi SDL_atoi_inline
   1.430 -
   1.431  extern DECLSPEC double SDLCALL SDL_atof(const char *str);
   1.432 -#ifdef HAVE_ATOF
   1.433 -SDL_FORCE_INLINE double SDL_atof_inline(const char *str) { return (double) atof(str); }
   1.434 -#else
   1.435 -SDL_FORCE_INLINE double SDL_atof_inline(const char *str) { return SDL_strtod(str, NULL); }
   1.436 -#endif
   1.437 -#define SDL_atof SDL_atof_inline
   1.438 -
   1.439 +extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
   1.440 +extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
   1.441 +extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
   1.442 +extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
   1.443 +extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
   1.444  
   1.445  extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
   1.446 -#ifdef HAVE_STRCMP
   1.447 -SDL_FORCE_INLINE int SDL_strcmp_inline(const char *str1, const char *str2) { return strcmp(str1, str2); }
   1.448 -#define SDL_strcmp SDL_strcmp_inline
   1.449 -#endif
   1.450 +extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
   1.451 +extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
   1.452 +extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
   1.453  
   1.454 -extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
   1.455 -#ifdef HAVE_STRNCMP
   1.456 -SDL_FORCE_INLINE int SDL_strncmp_inline(const char *str1, const char *str2, size_t maxlen) { return strncmp(str1, str2, maxlen); }
   1.457 -#define SDL_strncmp SDL_strncmp_inline
   1.458 -#endif
   1.459 -
   1.460 -extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
   1.461 -#ifdef HAVE_STRCASECMP
   1.462 -SDL_FORCE_INLINE int SDL_strcasecmp_inline(const char *str1, const char *str2) { return strcasecmp(str1, str2); }
   1.463 -#define SDL_strcasecmp SDL_strcasecmp_inline
   1.464 -#elif defined(HAVE__STRICMP)
   1.465 -SDL_FORCE_INLINE int SDL_strcasecmp_inline(const char *str1, const char *str2) { return _stricmp(str1, str2); }
   1.466 -#define SDL_strcasecmp SDL_strcasecmp_inline
   1.467 -#endif
   1.468 -
   1.469 -extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
   1.470 -#ifdef HAVE_STRNCASECMP
   1.471 -SDL_FORCE_INLINE int SDL_strncasecmp_inline(const char *str1, const char *str2, size_t len) { return strncasecmp(str1, str2, len); }
   1.472 -#define SDL_strncasecmp SDL_strncasecmp_inline
   1.473 -#elif defined(HAVE__STRNICMP)
   1.474 -SDL_FORCE_INLINE int SDL_strncasecmp_inline(const char *str1, const char *str2, size_t len) { return _strnicmp(str1, str2, len); }
   1.475 -#define SDL_strncasecmp SDL_strncasecmp_inline
   1.476 -#endif
   1.477 -
   1.478 -/* Not doing SDL_*_inline functions for these, because of the varargs. */
   1.479  extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...);
   1.480 -#ifdef HAVE_SSCANF
   1.481 -#define SDL_sscanf sscanf
   1.482 -#endif
   1.483 -
   1.484  extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...);
   1.485 -#ifdef HAVE_SNPRINTF
   1.486 -#define SDL_snprintf snprintf
   1.487 -#endif
   1.488 -
   1.489  extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
   1.490 -#ifdef HAVE_VSNPRINTF
   1.491 -SDL_FORCE_INLINE int SDL_vsnprintf_inline(char *text, size_t maxlen, const char *fmt, va_list ap) { return vsnprintf(text, maxlen, fmt, ap); }
   1.492 -#define SDL_vsnprintf SDL_vsnprintf_inline
   1.493 -#endif
   1.494  
   1.495  #ifndef HAVE_M_PI
   1.496  #ifndef M_PI
   1.497 @@ -675,100 +348,25 @@
   1.498  #endif
   1.499  
   1.500  extern DECLSPEC double SDLCALL SDL_atan(double x);
   1.501 -#ifdef HAVE_ATAN
   1.502 -SDL_FORCE_INLINE double SDL_atan_inline(double x) { return atan(x); }
   1.503 -#define SDL_atan SDL_atan_inline
   1.504 -#endif
   1.505 -
   1.506  extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
   1.507 -#ifdef HAVE_ATAN2
   1.508 -SDL_FORCE_INLINE double SDL_atan2_inline(double x, double y) { return atan2(x, y); }
   1.509 -#define SDL_atan2 SDL_atan2_inline
   1.510 -#endif
   1.511 -
   1.512  extern DECLSPEC double SDLCALL SDL_ceil(double x);
   1.513 -#ifdef HAVE_CEIL
   1.514 -SDL_FORCE_INLINE double SDL_ceil_inline(double x) { return ceil(x); }
   1.515 -#else
   1.516 -SDL_FORCE_INLINE double SDL_ceil_inline(double x) { return (double)(int)((x)+0.5); }
   1.517 -#endif
   1.518 -#define SDL_ceil SDL_ceil_inline
   1.519 -
   1.520  extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
   1.521 -#ifdef HAVE_COPYSIGN
   1.522 -SDL_FORCE_INLINE double SDL_copysign_inline(double x, double y) { return copysign(x, y); }
   1.523 -#define SDL_copysign SDL_copysign_inline
   1.524 -#endif
   1.525 -
   1.526  extern DECLSPEC double SDLCALL SDL_cos(double x);
   1.527 -#ifdef HAVE_COS
   1.528 -SDL_FORCE_INLINE double SDL_cos_inline(double x) { return cos(x); }
   1.529 -#define SDL_cos SDL_cos_inline
   1.530 -#endif
   1.531 -
   1.532  extern DECLSPEC float SDLCALL SDL_cosf(float x);
   1.533 -#ifdef HAVE_COSF
   1.534 -SDL_FORCE_INLINE float SDL_cosf_inline(float x) { return cosf(x); }
   1.535 -#else
   1.536 -SDL_FORCE_INLINE float SDL_cosf_inline(float x) { return (float)SDL_cos((double)x); }
   1.537 -#endif
   1.538 -#define SDL_cosf SDL_cosf_inline
   1.539 -
   1.540  extern DECLSPEC double SDLCALL SDL_fabs(double x);
   1.541 -#ifdef HAVE_FABS
   1.542 -SDL_FORCE_INLINE double SDL_fabs_inline(double x) { return fabs(x); }
   1.543 -#define SDL_fabs SDL_fabs_inline
   1.544 -#endif
   1.545 -
   1.546  extern DECLSPEC double SDLCALL SDL_floor(double x);
   1.547 -#ifdef HAVE_FLOOR
   1.548 -SDL_FORCE_INLINE double SDL_floor_inline(double x) { return floor(x); }
   1.549 -#define SDL_floor SDL_floor_inline
   1.550 -#endif
   1.551 -
   1.552  extern DECLSPEC double SDLCALL SDL_log(double x);
   1.553 -#ifdef HAVE_LOG
   1.554 -SDL_FORCE_INLINE double SDL_log_inline(double x) { return log(x); }
   1.555 -#define SDL_log SDL_log_inline
   1.556 -#endif
   1.557 -
   1.558  extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
   1.559 -#ifdef HAVE_POW
   1.560 -SDL_FORCE_INLINE double SDL_pow_inline(double x, double y) { return pow(x, y); }
   1.561 -#define SDL_pow SDL_pow_inline
   1.562 -#endif
   1.563 -
   1.564  extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
   1.565 -#ifdef HAVE_SCALBN
   1.566 -SDL_FORCE_INLINE double SDL_scalbn_inline(double x, int n) { return scalbn(x, n); }
   1.567 -#define SDL_scalbn SDL_scalbn_inline
   1.568 -#endif
   1.569 -
   1.570  extern DECLSPEC double SDLCALL SDL_sin(double x);
   1.571 -#ifdef HAVE_SIN
   1.572 -SDL_FORCE_INLINE double SDL_sin_inline(double x) { return sin(x); }
   1.573 -#define SDL_sin SDL_sin_inline
   1.574 -#endif
   1.575 -
   1.576  extern DECLSPEC float SDLCALL SDL_sinf(float x);
   1.577 -#ifdef HAVE_SINF
   1.578 -SDL_FORCE_INLINE float SDL_sinf_inline(float x) { return sinf(x); }
   1.579 -#else
   1.580 -SDL_FORCE_INLINE float SDL_sinf_inline(float x) { return (float)SDL_sin((double)x); }
   1.581 -#endif
   1.582 -#define SDL_sinf SDL_sinf_inline
   1.583 -
   1.584  extern DECLSPEC double SDLCALL SDL_sqrt(double x);
   1.585 -#ifdef HAVE_SQRT
   1.586 -SDL_FORCE_INLINE double SDL_sqrt_inline(double x) { return sqrt(x); }
   1.587 -#define SDL_sqrt SDL_sqrt_inline
   1.588 -#endif
   1.589  
   1.590  /* The SDL implementation of iconv() returns these error codes */
   1.591 -#define SDL_ICONV_ERROR		(size_t)-1
   1.592 -#define SDL_ICONV_E2BIG		(size_t)-2
   1.593 -#define SDL_ICONV_EILSEQ	(size_t)-3
   1.594 -#define SDL_ICONV_EINVAL	(size_t)-4
   1.595 +#define SDL_ICONV_ERROR     (size_t)-1
   1.596 +#define SDL_ICONV_E2BIG     (size_t)-2
   1.597 +#define SDL_ICONV_EILSEQ    (size_t)-3
   1.598 +#define SDL_ICONV_EINVAL    (size_t)-4
   1.599  
   1.600  /* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
   1.601  typedef struct _SDL_iconv_t *SDL_iconv_t;
   1.602 @@ -786,15 +384,13 @@
   1.603                                                 const char *fromcode,
   1.604                                                 const char *inbuf,
   1.605                                                 size_t inbytesleft);
   1.606 -#define SDL_iconv_utf8_locale(S)	SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
   1.607 -#define SDL_iconv_utf8_ucs2(S)		(Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
   1.608 -#define SDL_iconv_utf8_ucs4(S)		(Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
   1.609 +#define SDL_iconv_utf8_locale(S)    SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
   1.610 +#define SDL_iconv_utf8_ucs2(S)      (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
   1.611 +#define SDL_iconv_utf8_ucs4(S)      (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
   1.612  
   1.613  /* Ends C function definitions when using C++ */
   1.614  #ifdef __cplusplus
   1.615 -/* *INDENT-OFF* */
   1.616  }
   1.617 -/* *INDENT-ON* */
   1.618  #endif
   1.619  #include "close_code.h"
   1.620