diff options
author | Stefan Reinauer <stepan@coresystems.de> | 2009-03-06 17:22:35 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@openbios.org> | 2009-03-06 17:22:35 +0000 |
commit | 054c7235c3d1094214b9cbe9f2cc876dfb249d62 (patch) | |
tree | 85585d847b3f3b9e5efd16c8c20d4770221f37a7 | |
parent | f8c77e82c5bd097d65fdd26022ef1ad559f3c87b (diff) |
use pointers instead of size_t when dealing with pointers. Also fix a few
warnings (trivial)
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3976 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r-- | src/lib/malloc.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/malloc.c b/src/lib/malloc.c index f2b8fd286e..347ef0d67b 100644 --- a/src/lib/malloc.c +++ b/src/lib/malloc.c @@ -4,36 +4,36 @@ #if 0 #define MALLOCDBG(x) #else -#define MALLOCDBG(x) printk_spew x +#define MALLOCDBG(x...) printk_spew(x) #endif extern unsigned char _heap, _eheap; -static size_t free_mem_ptr = (size_t)&_heap; /* Start of heap */ -static size_t free_mem_end_ptr = (size_t)&_eheap; /* End of heap */ +static void *free_mem_ptr = &_heap; /* Start of heap */ +static void *free_mem_end_ptr = &_eheap; /* End of heap */ void malloc_mark(malloc_mark_t *place) { - *place = free_mem_ptr; - printk_spew("malloc_mark 0x%08lx\n", (unsigned long)free_mem_ptr); + *place = (malloc_mark_t)free_mem_ptr; + printk_spew("malloc_mark %p\n", free_mem_ptr); } void malloc_release(malloc_mark_t *ptr) { - free_mem_ptr = *ptr; - printk_spew("malloc_release 0x%08lx\n", (unsigned long)free_mem_ptr); + free_mem_ptr = (void *)*ptr; + printk_spew("malloc_release %p\n", free_mem_ptr); } void *malloc(size_t size) { void *p; - MALLOCDBG(("%s Enter, size %ld, free_mem_ptr 0x%08lx\n", __func__, size, free_mem_ptr)); + MALLOCDBG("%s Enter, size %ld, free_mem_ptr %p\n", __func__, size, free_mem_ptr); if (size < 0) die("Error! malloc: Size < 0"); if (free_mem_ptr <= 0) die("Error! malloc: Free_mem_ptr <= 0"); - free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ + free_mem_ptr = (void *)(((unsigned long)free_mem_ptr + 3) & ~3); /* Align */ p = (void *) free_mem_ptr; free_mem_ptr += size; @@ -41,7 +41,7 @@ void *malloc(size_t size) if (free_mem_ptr >= free_mem_end_ptr) die("Error! malloc: free_mem_ptr >= free_mem_end_ptr"); - MALLOCDBG(("malloc 0x%08lx\n", (unsigned long)p)); + MALLOCDBG("malloc %p\n", p); return p; } |