summaryrefslogtreecommitdiff
path: root/hashtbl.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-25 14:27:34 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-09-25 14:27:34 -0700
commitcfdf646e9a818067887cdc9c01ade5b79f699190 (patch)
tree9b72a37341ccc6718cf23d6a3527ddb22d9a6d9e /hashtbl.c
parent3e1aaa9dd0cc48e390deb1c3f356b3ad1781af67 (diff)
downloadnasm-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 'hashtbl.c')
-rw-r--r--hashtbl.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/hashtbl.c b/hashtbl.c
index 6ebba3e..cefd37f 100644
--- a/hashtbl.c
+++ b/hashtbl.c
@@ -15,9 +15,7 @@
static struct hash_tbl_node *alloc_table(size_t newsize)
{
size_t bytes = newsize*sizeof(struct hash_tbl_node);
- struct hash_tbl_node *newtbl = nasm_malloc(bytes);
-
- memset(newtbl, 0, bytes);
+ struct hash_tbl_node *newtbl = nasm_zalloc(bytes);
return newtbl;
}