diff options
author | Jan Beulich <jbeulich@suse.com> | 2011-10-04 14:15:26 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2011-10-04 14:15:26 +0200 |
commit | beb8eac93c9a38c417db4ae77430af5568e54f1c (patch) | |
tree | 1b95fb18c531342b3eb88a47c8069bf3e08826a6 /xen/common/xmalloc_tlsf.c | |
parent | 148ed3108078b354f4c7620c495e300d54ec2724 (diff) | |
download | xen-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.c | 7 |
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; |