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[].

OK, I see.  It's probably a matter of taste, but I would prefer to see
sizeof(main_arena.av[0]) used rather than the cast NULL pointer.  My C
standard draft says that expressions `usually' aren't evaluated within
sizeof, but only in a footnote.

Regards,
Wolfram.

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