[Mesa-dev] [PATCH 04/18] ralloc: SIZE_MAX is missing on Android

Chad Versace chad at chad-versace.us
Wed Aug 17 09:28:12 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/17/2011 08:31 AM, Ian Romanick wrote:
> On 08/16/2011 11:28 PM, Chia-I Wu wrote:
>> Define SIZE_MAX to UINT32_MAX for it. --- src/glsl/ralloc.c |    4 ++++ 1
>> files changed, 4 insertions(+), 0 deletions(-)
> 
>> diff --git a/src/glsl/ralloc.c b/src/glsl/ralloc.c index 6a5eac6..757ab5c
>> 100644 --- a/src/glsl/ralloc.c +++ b/src/glsl/ralloc.c @@ -46,6 +46,10
>> @@ #endif #endif
> 
>> +#ifdef ANDROID +#define SIZE_MAX UINT32_MAX +#endif +
> 
> Android doesn't have this in stdint.h?  C99 requires that it be there. 
> Either way, this assumes that size_t is a uint32_t, which it may not be. A
> better approach might be:
> 
> /* C99 requires that SIZE_MAX be at least 65536.  The allocator * shouldn't
> ever need it to be more than 2^32.  Good luck allocating a * a single block
> that big anyway. */ #ifndef SIZE_MAX #  if sizeof(size_t) >= 4 #    define
> SIZE_MAX UINT32_MAX #  else #    define SIZE_MAX 65536 #  endif #endif

Bionic defines SIZE_MAX in bionic/arch-x86/include/machine/limits.h. By
inspecting the include chain below, I believe simply including <limits.h> will
do the job.

arch-x86/include/machine/limits.h:#define SIZE_MAX
include/sys/limits.h:#include <machine/limits.h>
include/limits.h:#include <sys/limits.h>

- -- 
Chad Versace
chad at chad-versace.us
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOS+wbAAoJEAIvNt057x8ierUQAJgnbYYKyj9wxkTqs6nUb3r4
rxjgQwxt1rxuj9mz6/yx9nWCYWwGdgK7dl8JwKStvc07OoDvLErkAilqsj7jgNMo
/Lxq/VzzsNs0JZ0YuPHnblZotKdUhfwn4QBuYguPB7LMAkrzR47k2HEGXHX/etOo
fcM++mjI95AG59vnQMB8IjEZTCqmbazGuIcRdzP/3qZnImZ88wCuXZ+bta/1y76p
bHJwiOONcGykMGjJITNjLJBLv0LtojWXgAV4peOdLO7Rn5cK/EjmJHkLgzG+M+PL
Or/F09UrtYhfIYbRirx0oh/aFCt0i5IeMqSfq/k73Ph/TJIeGwN1HpMzhlkKWTYY
sPp6ezWg5Qtmgy72Kvk4+wHmVTRY4VFpGq+Ekpe1v+tnF8fZxz1hSHHgpRjvgTi8
DPs6cHu/9V/7QRYwQk0XqhhBe/iXT72x8eJGFVWfPjv/qgKwuo13g0Ve4cQ572pa
EnjG2rQ8ZprmFjG2WmzVL+MIWjaG7HI1xxaNrlbSNtO7riT/IMO6qDDFMdmGuI+p
HTDE4WY+hyRPn11aMFqL6z0cb0eeJ1zgXsHIDLIqYqD5qHMS4IZDztBT30DRMhBF
Awi2hQDe7LMlHbLWnxXKby3j1hqeHM8nxbKTKMTvQ2yOPAqhlCSCYmzbQDuE25vZ
Z7gt0bgix2iryk4P7n+v
=zSOl
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list