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

From: Pekka Enberg
Date: Wed Jun 09 2004 - 16:09:28 EST


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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/