mirror of git://sourceware.org/git/glibc.git
Minor optimization of getaddrinfo after recent patch
This commit is contained in:
parent
b36b153d5d
commit
c5e3c2ae59
|
@ -1,5 +1,8 @@
|
||||||
2011-06-21 Ulrich Drepper <drepper@gmail.com>
|
2011-06-21 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
|
* sysdeps/posix/getaddrinfo.c (gaih_inet): After the last change the
|
||||||
|
branch using gethostbyname2 is only for AF_INET. Optimize accordingly.
|
||||||
|
|
||||||
* inet/getnetgrent_r.c: Use DL_CALL_FCT in several places.
|
* inet/getnetgrent_r.c: Use DL_CALL_FCT in several places.
|
||||||
|
|
||||||
2011-06-20 David S. Miller <davem@davemloft.net>
|
2011-06-20 David S. Miller <davem@davemloft.net>
|
||||||
|
|
|
@ -565,7 +565,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
|
||||||
IPv6 scope ids. */
|
IPv6 scope ids. */
|
||||||
if (req->ai_family == AF_INET)
|
if (req->ai_family == AF_INET)
|
||||||
{
|
{
|
||||||
int family = req->ai_family;
|
|
||||||
size_t tmpbuflen = 512;
|
size_t tmpbuflen = 512;
|
||||||
assert (tmpbuf == NULL);
|
assert (tmpbuf == NULL);
|
||||||
tmpbuf = alloca_account (tmpbuflen, alloca_used);
|
tmpbuf = alloca_account (tmpbuflen, alloca_used);
|
||||||
|
@ -576,7 +575,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
rc = __gethostbyname2_r (name, family, &th, tmpbuf,
|
rc = __gethostbyname2_r (name, AF_INET, &th, tmpbuf,
|
||||||
tmpbuflen, &h, &herrno);
|
tmpbuflen, &h, &herrno);
|
||||||
if (rc != ERANGE || herrno != NETDB_INTERNAL)
|
if (rc != ERANGE || herrno != NETDB_INTERNAL)
|
||||||
break;
|
break;
|
||||||
|
@ -638,18 +637,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
|
||||||
(*pat)->scopeid = 0;
|
(*pat)->scopeid = 0;
|
||||||
}
|
}
|
||||||
(*pat)->next = NULL;
|
(*pat)->next = NULL;
|
||||||
(*pat)->family = req->ai_family;
|
(*pat)->family = AF_INET;
|
||||||
if (family == req->ai_family)
|
memcpy ((*pat)->addr, h->h_addr_list[i],
|
||||||
memcpy ((*pat)->addr, h->h_addr_list[i],
|
h->h_length);
|
||||||
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 = &((*pat)->next);
|
pat = &((*pat)->next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue