[PATCH] fix to malloc checking

James Lemke jwlemke@codesourcery.com
Wed Mar 11 18:00:00 GMT 2015


Sorry for the delay.  I was out of the office for two weeks.

On 03/01/2015 10:08 PM, Mike Frysinger wrote:
> On 04 Feb 2015 13:56, James Lemke wrote:
>> --- a/malloc/hooks.c
>> +++ b/malloc/hooks.c
>>
>> +static unsigned char
>> +magicbyte (void *p)
>
> could be const

I agree, it should be.  I have changed it to:
static unsigned char
magicbyte (const void *p)

>> +{
>> +  unsigned char magic;
>> +
>> +  magic = (((size_t) p >> 3) ^ ((size_t) p >> 11)) & 0xFF;
>
> shouldn't you use uintptr_t instead of size_t ?

It is size_t because that's what the previous macro implementation used.
I don't see a strong reason to change the casts to uinptr_t,
but if you do I'll change them.

Thanks for the comments Mike.
OK to commit?

-- 
Jim Lemke, GNU Tools Sourcerer
Mentor Graphics / CodeSourcery
Orillia, Ontario



More information about the Libc-alpha mailing list