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