This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: malloc.c cleanups


Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> writes:

> They all look just fine to me, except for this:
> 
> > -#define next_bin(b)    ((mbinptr)((char*)(b) + 2 * sizeof(mbinptr)))
> > -#define prev_bin(b)    ((mbinptr)((char*)(b) - 2 * sizeof(mbinptr)))
> > +#define next_bin(b)    ((mbinptr)((char*)(b) + 2 * sizeof(((arena*)0)->av[0])))
> > +#define prev_bin(b)    ((mbinptr)((char*)(b) - 2 * sizeof(((arena*)0)->av[0])))
> 
> which I don't really consider an improvement.
> 
> Do changes like these really make a difference for BP, i.e. can more
> errors be detected?  If yes, that's pretty cool.

It's a maintenance aid more than anything else, since it guarantees
that next_bin & prev_bin will always be correct with respect to the
size of the array elements of av[].  I might want the av[] to be an
array of unbounded mbinptr, or I might want them to be bounded (I
prefer bounded, but right now I have some difficulties doing that, so
I've fallen back to unbounded).  Without this change, if I qaulify the
pointer elements of av[], I must also qualify the type arg of sizeof.

Greg

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]