diff options
author | Michael Brown <mcb30@etherboot.org> | 2006-12-02 20:10:21 +0000 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2006-12-02 20:10:21 +0000 |
commit | 3e0286dee3ae01047666f4944d304dbbee2e58a5 (patch) | |
tree | d3b73373076517d5fa2e5b1894dba668ba6f5c0e /src | |
parent | 4cd56820ea8767d0a6e7444e1b453a69322f8f2e (diff) | |
download | ipxe-3e0286dee3ae01047666f4944d304dbbee2e58a5.zip ipxe-3e0286dee3ae01047666f4944d304dbbee2e58a5.tar.gz ipxe-3e0286dee3ae01047666f4944d304dbbee2e58a5.tar.bz2 |
Move ANSI C standard prototypes to stdlib.h; leave the gPXE-specific
function prototypes (e.g. malloc_dma()) in malloc.h.
Diffstat (limited to 'src')
-rw-r--r-- | src/include/malloc.h | 28 | ||||
-rw-r--r-- | src/include/stdlib.h | 20 |
2 files changed, 28 insertions, 20 deletions
diff --git a/src/include/malloc.h b/src/include/malloc.h index ee013f4..b14ec78 100644 --- a/src/include/malloc.h +++ b/src/include/malloc.h @@ -9,11 +9,16 @@ * */ +/* + * Prototypes for the standard functions (malloc() et al) are in + * stdlib.h. Include <malloc.h> only if you need the non-standard + * functions, such as malloc_dma(). + * + */ +#include <stdlib.h> + extern void * alloc_memblock ( size_t size, size_t align ); extern void free_memblock ( void *ptr, size_t size ); -extern void * realloc ( void *old_ptr, size_t new_size ); -extern void * malloc ( size_t size ); -extern void free ( void *ptr ); extern void mpopulate ( void *start, size_t len ); extern void mdumpfree ( void ); @@ -47,21 +52,4 @@ static inline void free_dma ( void *ptr, size_t size ) { free_memblock ( ptr, size ); } -/** - * Allocate cleared memory - * - * @v nmemb Number of members - * @v size Size of each member - * @ret ptr Allocated memory - * - * Allocate memory as per malloc(), and zero it. - * - * Note that malloc() and calloc() are identical, in the interests of - * reducing code size. Callers should not, however, rely on malloc() - * clearing memory, since this behaviour may change in future. - */ -static inline void * calloc ( size_t nmemb, size_t size ) { - return malloc ( nmemb * size ); -} - #endif /* _MALLOC_H */ diff --git a/src/include/stdlib.h b/src/include/stdlib.h index 4dd7e54..a7dd1d8 100644 --- a/src/include/stdlib.h +++ b/src/include/stdlib.h @@ -2,5 +2,25 @@ #define STDLIB_H extern unsigned long strtoul ( const char *p, char **endp, int base ); +extern void * realloc ( void *old_ptr, size_t new_size ); +extern void * malloc ( size_t size ); +extern void free ( void *ptr ); + +/** + * Allocate cleared memory + * + * @v nmemb Number of members + * @v size Size of each member + * @ret ptr Allocated memory + * + * Allocate memory as per malloc(), and zero it. + * + * Note that malloc() and calloc() are identical, in the interests of + * reducing code size. Callers should not, however, rely on malloc() + * clearing memory, since this behaviour may change in future. + */ +static inline void * calloc ( size_t nmemb, size_t size ) { + return malloc ( nmemb * size ); +} #endif /* STDLIB_H */ |