diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-02 17:19:55 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-02 17:19:55 +0000 |
commit | affb908232bd3e77a54c6864c59be46df560df86 (patch) | |
tree | 9cad62ccf4d696fe85c229f4263d1f75c8599c6d /src/dns.cpp | |
parent | 9604ff62cd2f5802ef571ca9286543b70c556e52 (diff) |
Tidyups (as usual)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4642 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dns.cpp')
-rw-r--r-- | src/dns.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
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; |