[PATCH 1/1] dummy_malloc: add calloc support
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Tue Jan 10 19:48:51 EST 2012
needed to use menu framework
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
common/dummy_malloc.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/common/dummy_malloc.c b/common/dummy_malloc.c
index 213e51d..ccee521 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;
+}
--
1.7.7
More information about the barebox
mailing list