aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/xmalloc_tlsf.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2011-10-04 14:15:26 +0200
committerJan Beulich <jbeulich@suse.com>2011-10-04 14:15:26 +0200
commitbeb8eac93c9a38c417db4ae77430af5568e54f1c (patch)
tree1b95fb18c531342b3eb88a47c8069bf3e08826a6 /xen/common/xmalloc_tlsf.c
parent148ed3108078b354f4c7620c495e300d54ec2724 (diff)
downloadxen-beb8eac93c9a38c417db4ae77430af5568e54f1c.tar.gz
xen-beb8eac93c9a38c417db4ae77430af5568e54f1c.tar.bz2
xen-beb8eac93c9a38c417db4ae77430af5568e54f1c.zip
introduce xzalloc() & Co
Rather than having to match a call to one of the xmalloc() flavors with a subsequent memset(), introduce a zeroing variant of each of those flavors. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/xmalloc_tlsf.c')
-rw-r--r--xen/common/xmalloc_tlsf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/xen/common/xmalloc_tlsf.c b/xen/common/xmalloc_tlsf.c
index 6be78e1b98..8a82355e09 100644
--- a/xen/common/xmalloc_tlsf.c
+++ b/xen/common/xmalloc_tlsf.c
@@ -585,6 +585,13 @@ void *_xmalloc(unsigned long size, unsigned long align)
return p;
}
+void *_xzalloc(unsigned long size, unsigned long align)
+{
+ void *p = _xmalloc(size, align);
+
+ return p ? memset(p, 0, size) : p;
+}
+
void xfree(void *p)
{
struct bhdr *b;