From ad544b5133ee7d1a164f840a4cf73b3bf3b3d370 Mon Sep 17 00:00:00 2001 From: waj334 Date: Sun, 30 Oct 2022 14:17:09 -0500 Subject: [PATCH] Implements calloc. --- src/runtime/baremetal.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/runtime/baremetal.go b/src/runtime/baremetal.go index b91fdb29..c4e44b7e 100644 --- a/src/runtime/baremetal.go +++ b/src/runtime/baremetal.go @@ -42,6 +42,12 @@ func libc_malloc(size uintptr) unsafe.Pointer { return alloc(size, nil) } +//export calloc +func libc_calloc(nmemb, size uintptr) unsafe.Pointer { + // No difference between calloc and malloc. + return libc_malloc(nmemb * size) +} + //export free func libc_free(ptr unsafe.Pointer) { free(ptr)