diff options
author | marha <marha@users.sourceforge.net> | 2009-12-22 18:18:58 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-12-22 18:18:58 +0000 |
commit | 3b79162ea5c5be078326f2e0ea85b0f84c02f166 (patch) | |
tree | 6826d1ef026f16ec12d35ee6bd4a892d0a05b7e0 /mesalib/src/mesa/main/imports.c | |
parent | 4284aeba874b9168f2228c59639bec8346a56796 (diff) | |
parent | b729d9e1cc1c60e415da24143cabcbaccb525ed7 (diff) | |
download | vcxsrv-3b79162ea5c5be078326f2e0ea85b0f84c02f166.tar.gz vcxsrv-3b79162ea5c5be078326f2e0ea85b0f84c02f166.tar.bz2 vcxsrv-3b79162ea5c5be078326f2e0ea85b0f84c02f166.zip |
svn merge ^/branches/released
Diffstat (limited to 'mesalib/src/mesa/main/imports.c')
-rw-r--r-- | mesalib/src/mesa/main/imports.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c index 6ffaddcde..46ffb929b 100644 --- a/mesalib/src/mesa/main/imports.c +++ b/mesalib/src/mesa/main/imports.c @@ -48,6 +48,13 @@ #include "context.h" #include "version.h" +#ifdef _GNU_SOURCE +#include <locale.h> +#ifdef __APPLE__ +#include <xlocale.h> +#endif +#endif + #define MAXSTRING 4000 /* for vsnprintf() */ @@ -101,8 +108,8 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) { #if defined(HAVE_POSIX_MEMALIGN) void *mem; - - (void) posix_memalign(& mem, alignment, bytes); + int err = posix_memalign(& mem, alignment, bytes); + (void) err; return mem; #elif defined(_WIN32) && defined(_MSC_VER) return _aligned_malloc(bytes, alignment); @@ -908,7 +915,15 @@ _mesa_atoi(const char *s) double _mesa_strtod( const char *s, char **end ) { +#ifdef _GNU_SOURCE + static locale_t loc = NULL; + if (!loc) { + loc = newlocale(LC_CTYPE_MASK, "C", NULL); + } + return strtod_l(s, end, loc); +#else return strtod(s, end); +#endif } /** Compute simple checksum/hash for a string */ @@ -919,9 +934,9 @@ _mesa_str_checksum(const char *str) unsigned int sum, i; const char *c; sum = i = 1; - for (c = str; *c; c++) + for (c = str; *c; c++, i++) sum += *c * (i % 100); - return sum; + return sum + i; } |