[BusyBox] should xmalloc clear memmory ?

Glenn McGrath bug1 at optushome.com.au
Mon Feb 12 00:50:46 UTC 2001


Matt Kraai wrote:
> 
> On Sun, Feb 11, 2001 at 10:48:12AM +1100, Glenn McGrath wrote:
> > Using grep memset -r *|wc -l
> >
> > there are 75 places where we use memset, 5 of them dont set it to 0,
> > probably a lot of the remaining 70 are happening imediately after
> > xmalloc.
> >
> > So, if we cleared memory inside xmalloc we could remove upto 70
> > statments.
> >
> > Would this be a bad idea for any reason ?
> 
> xcalloc.
> 

Oh yea, forgot about calloc :)

b.t.w does anyone know why calloc has a different calling structure than
malloc ?

void *calloc(size_t nmemb, size_t size);
void *malloc(size_t size);

for calloc why wouldnt they just do 

void *calloc(size_t size);

It could always be called like calloc(nemb*size), or am i missing the
point ?

Glenn





More information about the busybox mailing list