Messages in this thread Patch in this message | | | Date | Wed, 9 Jun 2004 00:24:56 +0300 | From | Pekka J Enberg <> | Subject | [PATCH] ALSA: Remove subsystem-specific malloc (1/8) |
| |
Introduce kcalloc() in linux/slab.h that is used to replace snd_calloc() and snd_magic_calloc().
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
include/linux/slab.h | 1 + mm/slab.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+)
--- linux-2.6.6/include/linux/slab.h 2004-06-08 23:54:41.382519192 +0300 +++ alsa-2.6.6/include/linux/slab.h 2004-06-08 21:36:12.951592680 +0300 @@ -95,6 +95,7 @@ found: return __kmalloc(size, flags); } +extern void *kcalloc(size_t, int); extern void kfree(const void *); extern unsigned int ksize(const void *); --- linux-2.6.6/mm/slab.c 2004-06-08 23:57:30.713776928 +0300 +++ alsa-2.6.6/mm/slab.c 2004-06-08 21:42:18.000000000 +0300 @@ -2332,6 +2332,21 @@ void kmem_cache_free (kmem_cache_t *cach EXPORT_SYMBOL(kmem_cache_free); /** + * kcalloc - allocate memory. The memory is set to zero. + * @size: how many bytes of memory are required. + * @flags: the type of memory to allocate. + */ +void *kcalloc(size_t size, int flags) +{ + void *ret = kmalloc(size, flags); + if (ret) + memset(ret, 0, size); + return ret; +} + +EXPORT_SYMBOL(kcalloc); + +/** * kfree - free previously allocated memory * @objp: pointer returned by kmalloc. * - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |