* [PATCH 1/1] dummy_malloc: add calloc support
@ 2012-01-11 0:48 Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; only message in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-01-11 0:48 UTC (permalink / raw)
To: barebox
needed to use menu framework
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@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
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-01-11 0:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-11 0:48 [PATCH 1/1] dummy_malloc: add calloc support Jean-Christophe PLAGNIOL-VILLARD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox