From 39af394a1c3ae1d8ac71ad263a7c524988702c2e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 6 Oct 2004 07:50:18 +0000 Subject: removed tabs and trailing whitespace from source --- ares/ares_parse_ptr_reply.c | 110 ++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'ares/ares_parse_ptr_reply.c') diff --git a/ares/ares_parse_ptr_reply.c b/ares/ares_parse_ptr_reply.c index 888b029cf..20df4114b 100644 --- a/ares/ares_parse_ptr_reply.c +++ b/ares/ares_parse_ptr_reply.c @@ -32,7 +32,7 @@ #include "ares_private.h" int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, - int addrlen, int family, struct hostent **host) + int addrlen, int family, struct hostent **host) { unsigned int qdcount, ancount; int status, i, rr_type, rr_class, rr_len; @@ -73,47 +73,47 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, /* Decode the RR up to the data field. */ status = ares_expand_name(aptr, abuf, alen, &rr_name, &len); if (status != ARES_SUCCESS) - break; + break; aptr += len; if (aptr + RRFIXEDSZ > abuf + alen) - { - status = ARES_EBADRESP; - break; - } + { + status = ARES_EBADRESP; + break; + } rr_type = DNS_RR_TYPE(aptr); rr_class = DNS_RR_CLASS(aptr); rr_len = DNS_RR_LEN(aptr); aptr += RRFIXEDSZ; if (rr_class == C_IN && rr_type == T_PTR - && strcasecmp(rr_name, ptrname) == 0) - { - /* Decode the RR data and set hostname to it. */ - status = ares_expand_name(aptr, abuf, alen, &rr_data, &len); - if (status != ARES_SUCCESS) - break; - if (hostname) - free(hostname); - hostname = rr_data; - } + && strcasecmp(rr_name, ptrname) == 0) + { + /* Decode the RR data and set hostname to it. */ + status = ares_expand_name(aptr, abuf, alen, &rr_data, &len); + if (status != ARES_SUCCESS) + break; + if (hostname) + free(hostname); + hostname = rr_data; + } if (rr_class == C_IN && rr_type == T_CNAME) - { - /* Decode the RR data and replace ptrname with it. */ - status = ares_expand_name(aptr, abuf, alen, &rr_data, &len); - if (status != ARES_SUCCESS) - break; - free(ptrname); - ptrname = rr_data; - } + { + /* Decode the RR data and replace ptrname with it. */ + status = ares_expand_name(aptr, abuf, alen, &rr_data, &len); + if (status != ARES_SUCCESS) + break; + free(ptrname); + ptrname = rr_data; + } free(rr_name); aptr += rr_len; if (aptr > abuf + alen) - { - status = ARES_EBADRESP; - break; - } + { + status = ARES_EBADRESP; + break; + } } if (status == ARES_SUCCESS && !hostname) @@ -123,33 +123,33 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, /* We got our answer. Allocate memory to build the host entry. */ hostent = malloc(sizeof(struct hostent)); if (hostent) - { - hostent->h_addr_list = malloc(2 * sizeof(char *)); - if (hostent->h_addr_list) - { - hostent->h_addr_list[0] = malloc(addrlen); - if (hostent->h_addr_list[0]) - { - hostent->h_aliases = malloc(sizeof (char *)); - if (hostent->h_aliases) - { - /* Fill in the hostent and return successfully. */ - hostent->h_name = hostname; - hostent->h_aliases[0] = NULL; - hostent->h_addrtype = family; - hostent->h_length = addrlen; - memcpy(hostent->h_addr_list[0], addr, addrlen); - hostent->h_addr_list[1] = NULL; - *host = hostent; - free(ptrname); - return ARES_SUCCESS; - } - free(hostent->h_addr_list[0]); - } - free(hostent->h_addr_list); - } - free(hostent); - } + { + hostent->h_addr_list = malloc(2 * sizeof(char *)); + if (hostent->h_addr_list) + { + hostent->h_addr_list[0] = malloc(addrlen); + if (hostent->h_addr_list[0]) + { + hostent->h_aliases = malloc(sizeof (char *)); + if (hostent->h_aliases) + { + /* Fill in the hostent and return successfully. */ + hostent->h_name = hostname; + hostent->h_aliases[0] = NULL; + hostent->h_addrtype = family; + hostent->h_length = addrlen; + memcpy(hostent->h_addr_list[0], addr, addrlen); + hostent->h_addr_list[1] = NULL; + *host = hostent; + free(ptrname); + return ARES_SUCCESS; + } + free(hostent->h_addr_list[0]); + } + free(hostent->h_addr_list); + } + free(hostent); + } status = ARES_ENOMEM; } if (hostname) -- cgit v1.2.3