[libc-trusty] Fix prototype conflicts in malloc.c
Inline brk because the prototype is non-standard.
Make sbrk non-static to match the prototype. We could rename it to
trusty_sbrk and keep the prototype static, but eventually we should
un-hack the preprocessor include of dlmalloc.c, and once we do that
we'll need a non-static sbrk.
Bug: 110161494
Change-Id: I2bedceb83fd7abcece917423a43705eb0464259a
diff --git a/lib/libc-trusty/malloc.c b/lib/libc-trusty/malloc.c
index ab770ba..c911c3d 100644
--- a/lib/libc-trusty/malloc.c
+++ b/lib/libc-trusty/malloc.c
@@ -43,25 +43,21 @@
#include <uapi/err.h>
#include <unistd.h>
-long brk(uint32_t brk) {
- return _trusty_brk(brk);
-}
-
static char* __libc_brk;
#define SBRK_ALIGN 32
-static void* sbrk(ptrdiff_t increment) {
+void* sbrk(ptrdiff_t increment) {
char* new_brk;
char* start;
char* end;
if (!__libc_brk)
- __libc_brk = (char*)brk(0);
+ __libc_brk = (char*)_trusty_brk(0);
start = (char*)round_up((long)__libc_brk, SBRK_ALIGN);
end = start + round_up((long)increment, SBRK_ALIGN);
- new_brk = (char*)brk((uint32_t)(uintptr_t)end);
+ new_brk = (char*)_trusty_brk((uint32_t)(uintptr_t)end);
if (new_brk < end)
return (void*)-1;