diff options
| author | Michael Brown | 2006-03-17 15:09:45 +0100 |
|---|---|---|
| committer | Michael Brown | 2006-03-17 15:09:45 +0100 |
| commit | a2b15fd1febc77aecfc99b9d366b13f0bc17bebd (patch) | |
| tree | 47cef6e48756f1d39f6404af8de70023a72c10bb /src/filo/main/malloc_x.c | |
| parent | Prefix semantics have changed (diff) | |
| download | ipxe-a2b15fd1febc77aecfc99b9d366b13f0bc17bebd.tar.gz ipxe-a2b15fd1febc77aecfc99b9d366b13f0bc17bebd.tar.xz ipxe-a2b15fd1febc77aecfc99b9d366b13f0bc17bebd.zip | |
GPXE code cleanup and purge.
Diffstat (limited to 'src/filo/main/malloc_x.c')
| -rw-r--r-- | src/filo/main/malloc_x.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/filo/main/malloc_x.c b/src/filo/main/malloc_x.c deleted file mode 100644 index 99b309aa7..000000000 --- a/src/filo/main/malloc_x.c +++ /dev/null @@ -1,45 +0,0 @@ -#include <etherboot.h> - -#include <lib.h> - -void *calloc(size_t nmemb, size_t size) -{ - size_t alloc_size = nmemb * size; - void *mem; - - if (alloc_size < nmemb || alloc_size < size) { - printf("calloc overflow: %u, %u\n", nmemb, size); - return 0; - } - - mem = allot(alloc_size); - memset(mem, 0, alloc_size); - - return mem; -} - -void *realloc(void *mem, size_t size) -{ - size_t copy_size; - void *new_mem; - size_t *mark, addr; - - if (mem == 0) - return allot(size); - if (size == 0) { - forget(mem); - return 0; - } - - addr = virt_to_phys(mem); - mark = phys_to_virt(addr - sizeof(size_t)); - copy_size = *mark; - - if (size < copy_size) - copy_size = size; - /* XXX should optimze this */ - new_mem = allot(size); - memcpy(new_mem, mem, copy_size); - forget(mem); - return new_mem; -} |
