lkml.org 
[lkml]   [2004]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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/
\
 
 \ /
  Last update: 2005-03-22 14:03    [W:0.279 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site