From f7f7332afafd4f965c5ef1d45cc1c7da9275c6ef Mon Sep 17 00:00:00 2001 From: David Timber Date: Mon, 14 Sep 2020 15:47:30 +0930 Subject: * Add "--enable-static" configure option * Change "PRNE_DEBUG" macro use * Add "PRNE_VERBOSE" * Impl "recon" * Add "inet.h" for Internet Protocol stuff * Changes regarding "PRNE_RND_WELL512_SEEDLEN" * Add prne_own_realloc() for objects with multiple array memebers * Add prne_add_timespec() --- src/resolv.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'src/resolv.c') diff --git a/src/resolv.c b/src/resolv.c index 30fbac6..7935479 100644 --- a/src/resolv.c +++ b/src/resolv.c @@ -1392,24 +1392,12 @@ void prne_resolv_free_ns_pool (prne_resolv_ns_pool_t *pool) { } bool prne_resolv_alloc_ns_pool (prne_resolv_ns_pool_t *pool, const size_t cnt) { - void *ny; - - ny = prne_realloc(pool->ownership ? pool->arr : NULL, sizeof(prne_net_endpoint_t), cnt); - if (ny != NULL) { - if (!pool->ownership) { - memcpy( - ny, - pool->arr, - prne_op_min(pool->cnt, cnt) * sizeof(prne_net_endpoint_t)); - } - pool->arr = (prne_net_endpoint_t*)ny; - pool->cnt = cnt; - pool->ownership = true; - - return true; - } - - return false; + return prne_own_realloc( + (void**)&pool->arr, + &pool->ownership, + sizeof(prne_net_endpoint_t), + &pool->cnt, + cnt); } prne_resolv_ns_pool_t prne_resolv_own_ns_pool(const prne_resolv_ns_pool_t *pool, const bool ownership) { -- cgit