2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-23 19:51:46 +00:00

Renamed _calloc() to zalloc(), ready to be used as a standalone function.

This commit is contained in:
Michael Brown 2007-06-11 21:36:10 +01:00
parent 0316eaf85d
commit 058b200529
2 changed files with 7 additions and 4 deletions

View File

@ -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 );

View File

@ -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 );
}
/*****************************************************************************