diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-09-25 14:27:34 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-09-25 14:27:34 -0700 |
commit | cfdf646e9a818067887cdc9c01ade5b79f699190 (patch) | |
tree | 9b72a37341ccc6718cf23d6a3527ddb22d9a6d9e /nasmlib.h | |
parent | 3e1aaa9dd0cc48e390deb1c3f356b3ad1781af67 (diff) | |
download | nasm-cfdf646e9a818067887cdc9c01ade5b79f699190.tar.gz nasm-cfdf646e9a818067887cdc9c01ade5b79f699190.tar.bz2 nasm-cfdf646e9a818067887cdc9c01ade5b79f699190.zip |
Add nasm_zalloc() to nasmlib.c
Add nasm_zalloc(), a wrapper around calloc(), to allocate
zero-initialized memory. For large allocations, this is often far
more efficient than allocating and zeroing, since the operating system
tends to keep a pool of zero pages around.
Diffstat (limited to 'nasmlib.h')
-rw-r--r-- | nasmlib.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -74,17 +74,20 @@ typedef void (*efunc) (int severity, const char *fmt, ...); void nasm_set_malloc_error(efunc); #ifndef LOGALLOC void *nasm_malloc(size_t); +void *nasm_zalloc(size_t); void *nasm_realloc(void *, size_t); void nasm_free(void *); char *nasm_strdup(const char *); char *nasm_strndup(char *, size_t); #else void *nasm_malloc_log(char *, int, size_t); +void *nasm_zalloc_log(char *, int, size_t); void *nasm_realloc_log(char *, int, void *, size_t); void nasm_free_log(char *, int, void *); char *nasm_strdup_log(char *, int, const char *); char *nasm_strndup_log(char *, int, char *, size_t); #define nasm_malloc(x) nasm_malloc_log(__FILE__,__LINE__,x) +#define nasm_zalloc(x) nasm_malloc_log(__FILE__,__LINE__,x) #define nasm_realloc(x,y) nasm_realloc_log(__FILE__,__LINE__,x,y) #define nasm_free(x) nasm_free_log(__FILE__,__LINE__,x) #define nasm_strdup(x) nasm_strdup_log(__FILE__,__LINE__,x) |