diff options
author | Yang Tse <yangsita@gmail.com> | 2009-10-08 18:38:29 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2009-10-08 18:38:29 +0000 |
commit | f3346ca16b7c87d6cfe0c1605321dbf0a706e57a (patch) | |
tree | 4c1c80d858cb7d96b3740b1d3d60779c16a7f12e /ares__get_hostent.c | |
parent | e112f191a3d94510c74ff8a01b6446b61eb4b547 (diff) | |
download | c-ares-f3346ca16b7c87d6cfe0c1605321dbf0a706e57a.tar.gz c-ares-f3346ca16b7c87d6cfe0c1605321dbf0a706e57a.tar.bz2 c-ares-f3346ca16b7c87d6cfe0c1605321dbf0a706e57a.zip |
Fix compiler warning
Diffstat (limited to 'ares__get_hostent.c')
-rw-r--r-- | ares__get_hostent.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ares__get_hostent.c b/ares__get_hostent.c index 4371c5b..0d4aee2 100644 --- a/ares__get_hostent.c +++ b/ares__get_hostent.c @@ -38,10 +38,10 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host) { char *line = NULL, *p, *q, **alias; char *txtaddr, *txthost, *txtalias; - int status, linesize, addrfam, naliases; + int status, addrfam; + size_t addrlen, linesize, naliases; struct in_addr addr; struct in6_addr addr6; - size_t addrlen; struct hostent *hostent = NULL; *host = NULL; /* Assume failure */ @@ -194,12 +194,13 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host) memcpy(hostent->h_addr_list[0], &addr6, sizeof(struct in6_addr)); /* Copy aliases. */ - hostent->h_aliases = malloc((((size_t)naliases) + 1) * sizeof(char *)); + hostent->h_aliases = malloc((naliases + 1) * sizeof(char *)); if (!hostent->h_aliases) break; alias = hostent->h_aliases; - while (naliases >= 0) + while (naliases) *(alias + naliases--) = NULL; + *alias = NULL; while (txtalias) { p = txtalias; |