diff options
| author | Michael Brown | 2007-06-11 22:36:22 +0200 |
|---|---|---|
| committer | Michael Brown | 2007-06-11 22:36:22 +0200 |
| commit | a74ecf3057726f18feaf48922be4421c941f8c25 (patch) | |
| tree | 17aeeb5d23d4e81d636366d4e1c9fbb2379eb484 /src | |
| parent | Updated TFTP and PXE UDP API code to use not-yet-implemented data-xfer (diff) | |
| parent | Renamed _calloc() to zalloc(), ready to be used as a standalone function. (diff) | |
| download | ipxe-a74ecf3057726f18feaf48922be4421c941f8c25.tar.gz ipxe-a74ecf3057726f18feaf48922be4421c941f8c25.tar.xz ipxe-a74ecf3057726f18feaf48922be4421c941f8c25.zip | |
Merge branch 'master' into mcb-tcp-xfer
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/malloc.c | 5 | ||||
| -rw-r--r-- | src/include/stdlib.h | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/core/malloc.c b/src/core/malloc.c index 6dfdd632a..bf94592cc 100644 --- a/src/core/malloc.c +++ b/src/core/malloc.c @@ -311,8 +311,11 @@ void free ( void *ptr ) { * @ret ptr Allocated memory * * Allocate memory as per malloc(), and zero it. + * + * This function name is non-standard, but pretty intuitive. + * zalloc(size) is always equivalent to calloc(1,size) */ -void * _calloc ( size_t size ) { +void * zalloc ( size_t size ) { void *data; data = malloc ( size ); diff --git a/src/include/stdlib.h b/src/include/stdlib.h index 6a0e91633..5c8fc3df4 100644 --- a/src/include/stdlib.h +++ b/src/include/stdlib.h @@ -23,7 +23,7 @@ extern unsigned long strtoul ( const char *p, char **endp, int base ); extern void * malloc ( size_t size ); extern void * realloc ( void *old_ptr, size_t new_size ); extern void free ( void *ptr ); -extern void * _calloc ( size_t len ); +extern void * zalloc ( size_t len ); /** * Allocate cleared memory @@ -35,11 +35,11 @@ extern void * _calloc ( size_t len ); * Allocate memory as per malloc(), and zero it. * * This is implemented as a static inline, with the body of the - * function in _calloc(), since in most cases @c nmemb will be 1 and + * function in zalloc(), since in most cases @c nmemb will be 1 and * doing the multiply is just wasteful. */ static inline void * calloc ( size_t nmemb, size_t size ) { - return _calloc ( nmemb * size ); + return zalloc ( nmemb * size ); } /***************************************************************************** |
