This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] fix to malloc checking
- From: James Lemke <jwlemke at codesourcery dot com>
- To: libc-alpha <libc-alpha at sourceware dot org>, Andreas Schwab <schwab at suse dot de>, Will Newton <will dot newton at linaro dot org>, Mike Frysinger <vapier at gentoo dot org>
- Date: Wed, 11 Mar 2015 14:00:03 -0400
- Subject: Re: [PATCH] fix to malloc checking
- Authentication-results: sourceware.org; auth=none
- References: <5462592E dot 9050301 at codesourcery dot com> <5474FA02 dot 6020701 at mentor dot com> <CANu=DmhJ3FqfxCKqoVyuS77UiJ92V8+a3ZuKo3xPX1pxppbxkw at mail dot gmail dot com> <54762A68 dot 5050801 at codesourcery dot com> <mvma92uqwhg dot fsf at hawking dot suse dot de> <54D26B54 dot 9050707 at codesourcery dot com> <20150302030859 dot GN19363 at vapier>
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