diff options
author | Daniel Stenberg <daniel@haxx.se> | 2010-05-26 23:16:28 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2010-06-02 23:10:21 +0200 |
commit | 0e8dc6f18eeb8a54115af2b2bd5693f933b6c27f (patch) | |
tree | 431a988990cc899ec3eb500d03217d9d7a81d04a /ares_getnameinfo.c | |
parent | cd59ae213f9adbe53e8cbade8e3159b56e618dc2 (diff) | |
download | c-ares-0e8dc6f18eeb8a54115af2b2bd5693f933b6c27f.tar.gz c-ares-0e8dc6f18eeb8a54115af2b2bd5693f933b6c27f.tar.bz2 c-ares-0e8dc6f18eeb8a54115af2b2bd5693f933b6c27f.zip |
style: make code less than 80 columns wide
Diffstat (limited to 'ares_getnameinfo.c')
-rw-r--r-- | ares_getnameinfo.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/ares_getnameinfo.c b/ares_getnameinfo.c index e2fe68e..fc4b7fa 100644 --- a/ares_getnameinfo.c +++ b/ares_getnameinfo.c @@ -80,7 +80,8 @@ struct nameinfo_query { (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")) #endif -static void nameinfo_callback(void *arg, int status, int timeouts, struct hostent *host); +static void nameinfo_callback(void *arg, int status, int timeouts, + struct hostent *host); static char *lookup_service(unsigned short port, int flags, char *buf, size_t buflen); #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID @@ -201,7 +202,8 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, } } -static void nameinfo_callback(void *arg, int status, int timeouts, struct hostent *host) +static void nameinfo_callback(void *arg, int status, int timeouts, + struct hostent *host) { struct nameinfo_query *niquery = (struct nameinfo_query *) arg; char srvbuf[33]; @@ -220,8 +222,8 @@ static void nameinfo_callback(void *arg, int status, int timeouts, struct hosten service = lookup_service(niquery->addr.addr6.sin6_port, niquery->flags, srvbuf, sizeof(srvbuf)); } - /* NOFQDN means we have to strip off the domain name portion. - We do this by determining our own domain name, then searching the string + /* NOFQDN means we have to strip off the domain name portion. We do + this by determining our own domain name, then searching the string for this domain name and removing it. */ #ifdef HAVE_GETHOSTNAME @@ -238,7 +240,8 @@ static void nameinfo_callback(void *arg, int status, int timeouts, struct hosten } } #endif - niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, (char *)(host->h_name), + niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, + (char *)(host->h_name), service); return; } @@ -247,12 +250,15 @@ static void nameinfo_callback(void *arg, int status, int timeouts, struct hosten { char ipbuf[IPBUFSIZ]; if (niquery->family == AF_INET) - ares_inet_ntop(AF_INET, &niquery->addr.addr4.sin_addr, ipbuf, IPBUFSIZ); + ares_inet_ntop(AF_INET, &niquery->addr.addr4.sin_addr, ipbuf, + IPBUFSIZ); else { - ares_inet_ntop(AF_INET6, &niquery->addr.addr6.sin6_addr, ipbuf, IPBUFSIZ); + ares_inet_ntop(AF_INET6, &niquery->addr.addr6.sin6_addr, ipbuf, + IPBUFSIZ); #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID - append_scopeid(&niquery->addr.addr6, niquery->flags, ipbuf, sizeof(ipbuf)); + append_scopeid(&niquery->addr.addr6, niquery->flags, ipbuf, + sizeof(ipbuf)); #endif } /* They want a service too */ @@ -265,7 +271,8 @@ static void nameinfo_callback(void *arg, int status, int timeouts, struct hosten service = lookup_service(niquery->addr.addr6.sin6_port, niquery->flags, srvbuf, sizeof(srvbuf)); } - niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, ipbuf, service); + niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, ipbuf, + service); return; } niquery->callback(niquery->arg, status, niquery->timeouts, NULL, NULL); @@ -300,10 +307,12 @@ static char *lookup_service(unsigned short port, int flags, sep = &se; memset(tmpbuf, 0, sizeof(tmpbuf)); #if GETSERVBYPORT_R_ARGS == 6 - if (getservbyport_r(port, proto, &se, (void *)tmpbuf, sizeof(tmpbuf), &sep) != 0) + if (getservbyport_r(port, proto, &se, (void *)tmpbuf, + sizeof(tmpbuf), &sep) != 0) sep = NULL; #elif GETSERVBYPORT_R_ARGS == 5 - sep = getservbyport_r(port, proto, &se, (void *)tmpbuf, sizeof(tmpbuf)); + sep = getservbyport_r(port, proto, &se, (void *)tmpbuf, + sizeof(tmpbuf)); #elif GETSERVBYPORT_R_ARGS == 4 if (getservbyport_r(port, proto, &se, (void *)tmpbuf) != 0) sep = NULL; @@ -349,7 +358,8 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags, char fmt_lu[] = "%lu"; char tmpbuf[IF_NAMESIZE + 2]; size_t bufl; - char *fmt = (sizeof(addr6->sin6_scope_id) > sizeof(unsigned int))?fmt_lu:fmt_u; + char *fmt = (sizeof(addr6->sin6_scope_id) > sizeof(unsigned int))? + fmt_lu:fmt_u; tmpbuf[0] = '%'; |