From 0c5d8b2c32eb0c9f285f534c917f2526f6c03ccb Mon Sep 17 00:00:00 2001 From: Neel Goyal Date: Thu, 15 Aug 2013 12:42:35 -0400 Subject: [PATCH] Tweak method sigs --- .gitignore | 1 + src/request-internal.c | 14 +++++++------- src/types-internal.h | 12 ++++++++---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 53e86aa2..11e7407f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *~ +.DS_Store Makefile.in getdns*.tar.gz *.o diff --git a/src/request-internal.c b/src/request-internal.c index d0bd5d29..fa1f73da 100644 --- a/src/request-internal.c +++ b/src/request-internal.c @@ -35,11 +35,11 @@ #define gd_malloc(sz) context->memory_allocator(sz) #define gd_free(ptr) context->memory_deallocator(ptr) -void network_req_free(getdns_context_t context, - getdns_network_req* net_req) { +void network_req_free(getdns_network_req* net_req) { if (!net_req) { return; } + getdns_context_t context = net_req->context; if (net_req->pkt) { ldns_pkt_free(net_req->pkt); } @@ -66,7 +66,7 @@ getdns_network_req* network_req_new(getdns_context_t context, pkt = create_new_pkt(context, name, request_type, extensions); if (!pkt) { /* free up the req */ - network_req_free(context, net_req); + network_req_free(net_req); return NULL; } net_req->pkt = pkt; @@ -78,12 +78,12 @@ getdns_network_req* network_req_new(getdns_context_t context, return net_req; } -void dns_req_free(getdns_context_t context, - getdns_dns_req* req) { +void dns_req_free(getdns_dns_req* req) { if (!req) { return; } - network_req_free(context, req->current_req); + getdns_context_t context = req->context; + network_req_free(req->current_req); gd_free(req); } @@ -108,7 +108,7 @@ getdns_dns_req* dns_req_new(getdns_context_t context, net_req = network_req_new(context, name, request_type, extensions, transaction_id); if (!net_req) { - dns_req_free(context, result); + dns_req_free(result); result = NULL; } diff --git a/src/types-internal.h b/src/types-internal.h index 08185580..e2a29cc0 100644 --- a/src/types-internal.h +++ b/src/types-internal.h @@ -65,7 +65,7 @@ typedef struct getdns_nameserver { int requests_inflight; } getdns_nameserver; -/* network request - state for a network request and referenced +/* network request - state for a single network request and referenced * by the the outbound_req */ typedef struct getdns_network_req { @@ -114,7 +114,7 @@ typedef struct getdns_dns_req { /* utility methods */ /* network request utilities */ -void network_req_free(getdns_context_t context, getdns_network_req* net_req); +void network_req_free(getdns_network_req* net_req); getdns_network_req* network_req_new(getdns_context_t context, const char* name, @@ -131,8 +131,12 @@ getdns_dns_req* dns_req_new(getdns_context_t context, getdns_transaction_t *transaction_id); -void dns_req_free(getdns_context_t context, - getdns_dns_req* req); +void dns_req_free(getdns_dns_req* req); + +/* nameserver utils */ +getdns_nameserver* nameserver_new_from_ip_dict(getdns_dict* ip_dict); + +void nameserver_free(getdns_nameserver* nameserver); #endif