From 2a3762495056381e1ef1809b482b670fcd45b6d5 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 7 Apr 2011 17:25:07 +0200 Subject: malloc: put common memory functions to seperate file These functions are needed independently of the specific malloc implementation, so move them out. Signed-off-by: Sascha Hauer --- common/dlmalloc.c | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'common/dlmalloc.c') diff --git a/common/dlmalloc.c b/common/dlmalloc.c index ff63fbec49..f9e1828cbf 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -882,56 +882,6 @@ static mbinptr av_[NAV * 2 + 2] = { /* ----------------------------------------------------------------------- */ -/* - * Begin and End of memory area for malloc(), and current "brk" - */ -static ulong malloc_start; -static ulong malloc_end; -static ulong malloc_brk; - -ulong mem_malloc_start(void) -{ - return malloc_start; -} - -ulong mem_malloc_end(void) -{ - return malloc_end; -} - -void mem_malloc_init(void *start, void *end) -{ - malloc_start = (ulong)start; - malloc_end = (ulong)end; - malloc_brk = malloc_start; -} - -static void *sbrk_no_zero(ptrdiff_t increment) -{ - ulong old = malloc_brk; - ulong new = old + increment; - - if ((new < malloc_start) || (new > malloc_end)) - return NULL; - - malloc_brk = new; - - return (void *)old; -} - -static void *sbrk(ptrdiff_t increment) -{ - void *old = sbrk_no_zero(increment); - - /* Only clear increment, if valid address was returned */ - if (old != NULL) - memset(old, 0, increment); - - return old; -} - -/* ----------------------------------------------------------------------- */ - /* Other static bookkeeping data */ /* variables holding tunable values */ -- cgit v1.2.3