summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-01-11 01:48:51 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-01-11 09:36:30 +0100
commit77b1e275301bc5792835d6f91d22c4bd9e4f34ac (patch)
treec3ceff2ca9e382dec808f4b5e06aa80cbce2a591 /common
parent78af988e41aad42fa2320e8625cd5602e2c519ab (diff)
downloadbarebox-77b1e275301bc5792835d6f91d22c4bd9e4f34ac.tar.gz
barebox-77b1e275301bc5792835d6f91d22c4bd9e4f34ac.tar.xz
dummy_malloc: add calloc support
needed to use menu framework Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/dummy_malloc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/dummy_malloc.c b/common/dummy_malloc.c
index 213e51d851..ccee521db6 100644
--- a/common/dummy_malloc.c
+++ b/common/dummy_malloc.c
@@ -24,3 +24,15 @@ void *realloc(void *ptr, size_t size)
BUG();
}
+void *calloc(size_t n, size_t elem_size)
+{
+ size_t size = elem_size * n;
+ void *r = malloc(size);
+
+ if (!r)
+ return r;
+
+ memset(r, 0x0, size);
+
+ return r;
+}