diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-04-07 17:25:07 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-04-11 15:57:51 +0200 |
commit | 2a3762495056381e1ef1809b482b670fcd45b6d5 (patch) | |
tree | f5ea3bf85ed5bf81baae0c0f79514195bea9010e /common/dlmalloc.c | |
parent | 4bfc4b44582670182c1519f931cbe0b0efec616e (diff) | |
download | barebox-2a3762495056381e1ef1809b482b670fcd45b6d5.tar.gz barebox-2a3762495056381e1ef1809b482b670fcd45b6d5.tar.xz |
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 <s.hauer@pengutronix.de>
Diffstat (limited to 'common/dlmalloc.c')
-rw-r--r-- | common/dlmalloc.c | 50 |
1 files changed, 0 insertions, 50 deletions
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 */ |