aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix/getaddrinfo.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-06-21 13:06:42 -0400
committerUlrich Drepper <drepper@gmail.com>2011-06-21 13:06:42 -0400
commitc5e3c2ae59cc8c5d3ad5e1adfd099c726baad862 (patch)
tree454d8391c6b751ee4ca533d66b81d787a6111a22 /sysdeps/posix/getaddrinfo.c
parentb36b153d5deb8fad8490b2544d416b24c9be922d (diff)
downloadglibc-c5e3c2ae59cc8c5d3ad5e1adfd099c726baad862.zip
glibc-c5e3c2ae59cc8c5d3ad5e1adfd099c726baad862.tar.gz
glibc-c5e3c2ae59cc8c5d3ad5e1adfd099c726baad862.tar.bz2
Minor optimization of getaddrinfo after recent patch
Diffstat (limited to 'sysdeps/posix/getaddrinfo.c')
-rw-r--r--sysdeps/posix/getaddrinfo.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 469abe2..d68ac83 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -565,7 +565,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
IPv6 scope ids. */
if (req->ai_family == AF_INET)
{
- int family = req->ai_family;
size_t tmpbuflen = 512;
assert (tmpbuf == NULL);
tmpbuf = alloca_account (tmpbuflen, alloca_used);
@@ -576,7 +575,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
while (1)
{
- rc = __gethostbyname2_r (name, family, &th, tmpbuf,
+ rc = __gethostbyname2_r (name, AF_INET, &th, tmpbuf,
tmpbuflen, &h, &herrno);
if (rc != ERANGE || herrno != NETDB_INTERNAL)
break;
@@ -638,18 +637,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
(*pat)->scopeid = 0;
}
(*pat)->next = NULL;
- (*pat)->family = req->ai_family;
- if (family == req->ai_family)
- memcpy ((*pat)->addr, h->h_addr_list[i],
- h->h_length);
- else
- {
- uint32_t *addr = (uint32_t *) (*pat)->addr;
- addr[3] = *(uint32_t *) h->h_addr_list[i];
- addr[2] = htonl (0xffff);
- addr[1] = 0;
- addr[0] = 0;
- }
+ (*pat)->family = AF_INET;
+ memcpy ((*pat)->addr, h->h_addr_list[i],
+ h->h_length);
pat = &((*pat)->next);
}
}