summaryrefslogtreecommitdiffstats
path: root/src/peer_hashtable.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-08-02 00:53:47 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-08-02 00:53:47 +0200
commit546ac7936340312cf272969ff83317ae4d50d2b4 (patch)
tree7ecadca11430c8624d9f80aae7c348fa4d65b969 /src/peer_hashtable.c
parentb22364f4af3564f0dd9a5f4e150bb09747bd5c4e (diff)
downloadfastd-546ac7936340312cf272969ff83317ae4d50d2b4.tar
fastd-546ac7936340312cf272969ff83317ae4d50d2b4.zip
Introduce and use alloc helpers
These new helpers will terminate fastd on allocation failures and add some additional convenience (allow strdup with NULL; typesafe new(type) macros).
Diffstat (limited to 'src/peer_hashtable.c')
-rw-r--r--src/peer_hashtable.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/peer_hashtable.c b/src/peer_hashtable.c
index 100e8a3..b835ea9 100644
--- a/src/peer_hashtable.c
+++ b/src/peer_hashtable.c
@@ -44,7 +44,7 @@
void fastd_peer_hashtable_init(void) {
fastd_random_bytes(&ctx.peer_addr_ht_seed, sizeof(ctx.peer_addr_ht_seed), false);
- ctx.peer_addr_ht = malloc(sizeof(*ctx.peer_addr_ht) * PEER_ADDR_HT_SIZE);
+ ctx.peer_addr_ht = fastd_new_array(PEER_ADDR_HT_SIZE, __typeof__(*ctx.peer_addr_ht));
size_t i;
for (i = 0; i < PEER_ADDR_HT_SIZE; i++)