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

Chad Versace chad at chad-versace.us
Thu Aug 18 06:46:05 PDT 2011


On 08/17/2011 08:06 PM, Chia-I Wu wrote:
> On Thu, Aug 18, 2011 at 12:28 AM, Chad Versace <chad at chad-versace.us> wrote:
> 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>
>> I will have ralloc include <limits.h> when ANDROID is defined.  I will
>> add a comment saying that SIZE_MAX is supposed to be in stdint.h.

Then this is
Reviewed-by: Chad Versace <chad at chad-versace.us>

-- 
Chad Versace
chad at chad-versace.us


More information about the mesa-dev mailing list