From affb908232bd3e77a54c6864c59be46df560df86 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 2 Aug 2006 17:19:55 +0000 Subject: Tidyups (as usual) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4642 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/dns.cpp | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'src/dns.cpp') diff --git a/src/dns.cpp b/src/dns.cpp index e2eca777c..f9cdadffe 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -113,18 +113,6 @@ class s_connection int send_requests(const s_header *h, const int l, QueryType qt); }; - - -void *dns_align(void *inp) -{ - char *p = (char*)inp; - int offby = ((char *)p - (char *)0) % (sizeof(void *) > sizeof(long) ? sizeof(void *) : sizeof(long)); - if (offby != 0) - return p + ((sizeof(void *) > sizeof(long) ? sizeof(void *) : sizeof(long)) - offby); - else - return p; -} - /* * Optimized by brain, these were using integer division and modulus. * We can use logic shifts and logic AND to replace these even divisions @@ -316,12 +304,13 @@ int DNS::dns_getip4(const char *name) { s_header h; int id; + int length; + s_connection* req; - int length = dns_build_query_payload(name,DNS_QRY_A,1,(unsigned char*)&h.payload); - if (length == -1) + if ((length = dns_build_query_payload(name,DNS_QRY_A,1,(unsigned char*)&h.payload)) == -1) return -1; - s_connection* req = dns_add_query(&h, id); - if (req == NULL) + + if ((req = dns_add_query(&h, id)) == NULL) return -1; if (req->send_requests(&h,length,DNS_QRY_A) == -1) @@ -338,17 +327,19 @@ int DNS::dns_getname4(const insp_inaddr *ip) char query[29]; s_header h; int id; + int length; + s_connection* req; unsigned char* c = (unsigned char*)&ip->s_addr; sprintf(query,"%d.%d.%d.%d.in-addr.arpa",c[3],c[2],c[1],c[0]); - int length = dns_build_query_payload(query,DNS_QRY_PTR,1,(unsigned char*)&h.payload); - if (length == -1) + if ((length = dns_build_query_payload(query,DNS_QRY_PTR,1,(unsigned char*)&h.payload)) == -1) return -1; - s_connection* req = dns_add_query(&h, id); - if (req == NULL) + + if ((req = dns_add_query(&h, id)) == NULL) return -1; + if (req->send_requests(&h,length,DNS_QRY_PTR) == -1) return -1; -- cgit v1.2.3