Re: [PATCH] ALSA: Remove subsystem-specific malloc (1/8)

Pekka Enberg
2004-06-09T21:05:59Z

On Wed, Jun 09, 2004 at 11:57:43PM +0300, Pekka Enberg wrote:
> > +void *kcalloc(size_t n, size_t size, int flags)
> > +{
> > + if (n != 0 && size > INT_MAX / n)
> > + return NULL;
> > +
> > + void *ret = kmalloc(n * size, flags);
> > + if (ret)
> > + memset(ret, 0, n * size);
> > + return ret;
> > +}

On Wed, 2004-06-09 at 23:59, Arjan van de Ven wrote:
> ok I like it ;)
>
> only question is what n==0 means, might as well short-circuit that but it's
> optional

Nah, I don't see the point. Now if I can only convince the ALSA guys to
switch to this... =)

Pekka