public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: Remove subsystem-specific malloc (1/8)
@ 2004-06-08 21:24 Pekka J Enberg
  2004-06-09 18:34 ` Chris Wright
  0 siblings, 1 reply; 16+ messages in thread
From: Pekka J Enberg @ 2004-06-08 21:24 UTC (permalink / raw)
  To: linux-kernel, tiwai

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.
  *

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2004-06-11 10:53 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-08 21:24 [PATCH] ALSA: Remove subsystem-specific malloc (1/8) Pekka J Enberg
2004-06-09 18:34 ` Chris Wright
2004-06-09 20:13   ` Pekka Enberg
2004-06-09 20:21     ` Arjan van de Ven
2004-06-09 20:40       ` Valdis.Kletnieks
2004-06-09 20:57       ` Chris Wright
2004-06-09 20:57       ` Pekka Enberg
2004-06-09 20:59         ` Arjan van de Ven
2004-06-09 21:07           ` Pekka Enberg
2004-06-11 10:09             ` Takashi Iwai
2004-06-11 10:43               ` Pekka J Enberg
2004-06-11 10:53               ` Pekka J Enberg
2004-06-09 21:00         ` [PATCH] " Chris Wright
2004-06-09 21:18           ` Pekka Enberg
2004-06-10  5:08         ` dean gaudet
2004-06-10 12:32           ` Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox