summaryrefslogtreecommitdiff
path: root/resolv
diff options
context:
space:
mode:
Diffstat (limited to 'resolv')
-rw-r--r--resolv/nss_dns/dns-host.c44
-rw-r--r--resolv/nss_dns/dns-network.c2
-rw-r--r--resolv/res_init.c2
-rw-r--r--resolv/res_mkquery.c4
-rw-r--r--resolv/res_query.c2
-rw-r--r--resolv/res_send.c36
6 files changed, 45 insertions, 45 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index f8f192e5af..541c25a348 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -398,7 +398,7 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
buffer += pad;
buflen = buflen > pad ? buflen - pad : 0;
- if (__builtin_expect (buflen < sizeof (struct host_data), 0))
+ if (__glibc_unlikely (buflen < sizeof (struct host_data)))
{
*errnop = ERANGE;
*h_errnop = NETDB_INTERNAL;
@@ -452,7 +452,7 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
break;
case AF_INET6:
/* Only lookup with the byte string format if the user wants it. */
- if (__builtin_expect (_res.options & RES_USEBSTRING, 0))
+ if (__glibc_unlikely (_res.options & RES_USEBSTRING))
{
qp = stpcpy (qbuf, "\\[x");
for (n = 0; n < IN6ADDRSZ; ++n)
@@ -613,7 +613,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
int have_to_map = 0;
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
buffer += pad;
- if (__builtin_expect (buflen < sizeof (struct host_data) + pad, 0))
+ if (__glibc_unlikely (buflen < sizeof (struct host_data) + pad))
{
/* The buffer is too small. */
too_small:
@@ -727,14 +727,14 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
n = -1;
}
- if (__builtin_expect (n < 0 || (*name_ok) (bp) == 0, 0))
+ if (__glibc_unlikely (n < 0 || (*name_ok) (bp) == 0))
{
++had_error;
continue;
}
cp += n; /* name */
- if (__builtin_expect (cp + 10 > end_of_message, 0))
+ if (__glibc_unlikely (cp + 10 > end_of_message))
{
++had_error;
continue;
@@ -748,7 +748,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
cp += INT32SZ; /* TTL */
n = __ns_get16 (cp);
cp += INT16SZ; /* len */
- if (__builtin_expect (class != C_IN, 0))
+ if (__glibc_unlikely (class != C_IN))
{
/* XXX - debug? syslog? */
cp += n;
@@ -764,7 +764,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (ap >= &host_data->aliases[MAX_NR_ALIASES - 1])
continue;
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (__builtin_expect (n < 0 || (*name_ok) (tbuf) == 0, 0))
+ if (__glibc_unlikely (n < 0 || (*name_ok) (tbuf) == 0))
{
++had_error;
continue;
@@ -782,7 +782,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
linebuflen -= n;
/* Get canonical name. */
n = strlen (tbuf) + 1; /* For the \0. */
- if (__builtin_expect (n > linebuflen, 0))
+ if (__glibc_unlikely (n > linebuflen))
goto too_small;
if (__builtin_expect (n, 0) >= MAXHOSTNAMELEN)
{
@@ -798,7 +798,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (qtype == T_PTR && type == T_CNAME)
{
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (__builtin_expect (n < 0 || res_dnok (tbuf) == 0, 0))
+ if (__glibc_unlikely (n < 0 || res_dnok (tbuf) == 0))
{
++had_error;
continue;
@@ -806,7 +806,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
cp += n;
/* Get canonical name. */
n = strlen (tbuf) + 1; /* For the \0. */
- if (__builtin_expect (n > linebuflen, 0))
+ if (__glibc_unlikely (n > linebuflen))
goto too_small;
if (__builtin_expect (n, 0) >= MAXHOSTNAMELEN)
{
@@ -833,7 +833,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (type == T_A && qtype == T_AAAA && map)
have_to_map = 1;
- else if (__builtin_expect (type != qtype, 0))
+ else if (__glibc_unlikely (type != qtype))
{
syslog (LOG_NOTICE | LOG_AUTH,
"gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
@@ -845,7 +845,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
switch (type)
{
case T_PTR:
- if (__builtin_expect (strcasecmp (tname, bp) != 0, 0))
+ if (__glibc_unlikely (strcasecmp (tname, bp) != 0))
{
syslog (LOG_NOTICE | LOG_AUTH, AskedForGot, qname, bp);
cp += n;
@@ -862,7 +862,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
n = -1;
}
- if (__builtin_expect (n < 0 || res_hnok (bp) == 0, 0))
+ if (__glibc_unlikely (n < 0 || res_hnok (bp) == 0))
{
++had_error;
break;
@@ -892,7 +892,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (have_to_map)
{
n = strlen (bp) + 1; /* for the \0 */
- if (__builtin_expect (n >= MAXHOSTNAMELEN, 0))
+ if (__glibc_unlikely (n >= MAXHOSTNAMELEN))
{
++had_error;
break;
@@ -938,7 +938,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
linebuflen -= sizeof (align) - ((u_long) bp % sizeof (align));
bp += sizeof (align) - ((u_long) bp % sizeof (align));
- if (__builtin_expect (n > linebuflen, 0))
+ if (__glibc_unlikely (n > linebuflen))
goto too_small;
bp = __mempcpy (*hap++ = bp, cp, n);
cp += n;
@@ -1009,7 +1009,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
int qdcount = ntohs (hp->qdcount);
const u_char *cp = answer->buf + HFIXEDSZ;
const u_char *end_of_message = answer->buf + anslen;
- if (__builtin_expect (qdcount != 1, 0))
+ if (__glibc_unlikely (qdcount != 1))
{
*h_errnop = NO_RECOVERY;
return NSS_STATUS_UNAVAIL;
@@ -1063,7 +1063,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
n = -1;
}
- if (__builtin_expect (n < 0 || res_hnok (buffer) == 0, 0))
+ if (__glibc_unlikely (n < 0 || res_hnok (buffer) == 0))
{
++had_error;
continue;
@@ -1077,7 +1077,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
cp += n; /* name */
- if (__builtin_expect (cp + 10 > end_of_message, 0))
+ if (__glibc_unlikely (cp + 10 > end_of_message))
{
++had_error;
continue;
@@ -1107,7 +1107,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
*ttlp = ttl;
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (__builtin_expect (n < 0 || res_hnok (tbuf) == 0, 0))
+ if (__glibc_unlikely (n < 0 || res_hnok (tbuf) == 0))
{
++had_error;
continue;
@@ -1124,9 +1124,9 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
}
n = strlen (tbuf) + 1;
- if (__builtin_expect (n > buflen, 0))
+ if (__glibc_unlikely (n > buflen))
goto too_small;
- if (__builtin_expect (n >= MAXHOSTNAMELEN, 0))
+ if (__glibc_unlikely (n >= MAXHOSTNAMELEN))
{
++had_error;
continue;
@@ -1143,7 +1143,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
// We should not see any types other than those explicitly listed
// below. Some types sent by server seem missing, though. Just
// collect the data for now.
- if (__builtin_expect (type != T_A && type != T_AAAA, 0))
+ if (__glibc_unlikely (type != T_A && type != T_AAAA))
#else
if (__builtin_expect (type == T_SIG, 0)
|| __builtin_expect (type == T_KEY, 0)
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 8e80a6010e..b8aee218e1 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -268,7 +268,7 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct net_data);
buffer += pad;
- if (__builtin_expect (buflen < sizeof (*net_data) + pad, 0))
+ if (__glibc_unlikely (buflen < sizeof (*net_data) + pad))
{
/* The buffer is too small. */
too_small:
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 5e1a747a4a..ea133f8d82 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -334,7 +334,7 @@ __res_vinit(res_state statp, int preinit) {
sa6->sin6_flowinfo = 0;
sa6->sin6_addr = a6;
- if (__builtin_expect (el == NULL, 1))
+ if (__glibc_likely (el == NULL))
sa6->sin6_scope_id = 0;
else {
int try_numericscope = 1;
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index 6170763fa3..1635e6a035 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -180,7 +180,7 @@ res_nmkquery(res_state statp,
n = ns_name_compress((char *)data, cp, buflen,
(const u_char **) dnptrs,
(const u_char **) lastdnptr);
- if (__builtin_expect (n < 0, 0))
+ if (__glibc_unlikely (n < 0))
return (-1);
cp += n;
buflen -= n;
@@ -195,7 +195,7 @@ res_nmkquery(res_state statp,
/*
* Initialize answer section
*/
- if (__builtin_expect (buflen < 1 + RRFIXEDSZ + datalen, 0))
+ if (__glibc_unlikely (buflen < 1 + RRFIXEDSZ + datalen))
return (-1);
*cp++ = '\0'; /* no domain name */
NS_PUT16 (type, cp);
diff --git a/resolv/res_query.c b/resolv/res_query.c
index 1325f9772d..88230f43eb 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -202,7 +202,7 @@ __libc_res_nquery(res_state statp,
goto again;
}
}
- if (__builtin_expect (n <= 0, 0)) {
+ if (__glibc_unlikely (n <= 0)) {
/* If the query choked with EDNS0, retry without EDNS0. */
if ((statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0
&& ((oflags ^ statp->_flags) & RES_F_EDNS0ERR) != 0) {
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 7f2e85f324..f46630d30f 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -358,7 +358,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
}
#ifdef USE_HOOKS
- if (__builtin_expect (statp->qhook || statp->rhook, 0)) {
+ if (__glibc_unlikely (statp->qhook || statp->rhook)) {
if (anssiz < MAXPACKET && ansp) {
u_char *buf = malloc (MAXPACKET);
if (buf == NULL)
@@ -499,7 +499,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
goto next_ns;
same_ns:
#ifdef USE_HOOKS
- if (__builtin_expect (statp->qhook != NULL, 0)) {
+ if (__glibc_unlikely (statp->qhook != NULL)) {
int done = 0, loops = 0;
do {
@@ -541,7 +541,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
: &((struct sockaddr_in *) nsap)->sin_addr),
tmpbuf, sizeof (tmpbuf))));
- if (__builtin_expect (v_circuit, 0)) {
+ if (__glibc_unlikely (v_circuit)) {
/* Use VC; at most one attempt per server. */
try = statp->retry;
n = send_vc(statp, buf, buflen, buf2, buflen2,
@@ -595,7 +595,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
__res_iclose(statp, false);
}
#ifdef USE_HOOKS
- if (__builtin_expect (statp->rhook, 0)) {
+ if (__glibc_unlikely (statp->rhook)) {
int done = 0, loops = 0;
do {
@@ -814,7 +814,7 @@ send_vc(res_state statp,
if (rlen > *thisanssizp) {
/* Yes, we test ANSCP here. If we have two buffers
both will be allocatable. */
- if (__builtin_expect (anscp != NULL, 1)) {
+ if (__glibc_likely (anscp != NULL)) {
u_char *newp = malloc (MAXPACKET);
if (newp == NULL) {
*terrno = ENOMEM;
@@ -835,7 +835,7 @@ send_vc(res_state statp,
} else
len = rlen;
- if (__builtin_expect (len < HFIXEDSZ, 0)) {
+ if (__glibc_unlikely (len < HFIXEDSZ)) {
/*
* Undersized message.
*/
@@ -851,13 +851,13 @@ send_vc(res_state statp,
cp += n;
len -= n;
}
- if (__builtin_expect (n <= 0, 0)) {
+ if (__glibc_unlikely (n <= 0)) {
*terrno = errno;
Perror(statp, stderr, "read(vc)", errno);
__res_iclose(statp, false);
return (0);
}
- if (__builtin_expect (truncating, 0)) {
+ if (__glibc_unlikely (truncating)) {
/*
* Flush rest of answer so connection stays in synch.
*/
@@ -917,7 +917,7 @@ reopen (res_state statp, int *terrno, int ns)
/* only try IPv6 if IPv6 NS and if not failed before */
if (nsap->sa_family == AF_INET6 && !statp->ipv6_unavail) {
- if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
+ if (__glibc_likely (__have_o_nonblock >= 0)) {
EXT(statp).nssocks[ns] =
socket(PF_INET6, SOCK_DGRAM|SOCK_NONBLOCK,
0);
@@ -928,14 +928,14 @@ reopen (res_state statp, int *terrno, int ns)
&& errno == EINVAL ? -1 : 1);
#endif
}
- if (__builtin_expect (__have_o_nonblock < 0, 0))
+ if (__glibc_unlikely (__have_o_nonblock < 0))
EXT(statp).nssocks[ns] =
socket(PF_INET6, SOCK_DGRAM, 0);
if (EXT(statp).nssocks[ns] < 0)
statp->ipv6_unavail = errno == EAFNOSUPPORT;
slen = sizeof (struct sockaddr_in6);
} else if (nsap->sa_family == AF_INET) {
- if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
+ if (__glibc_likely (__have_o_nonblock >= 0)) {
EXT(statp).nssocks[ns]
= socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK,
0);
@@ -946,7 +946,7 @@ reopen (res_state statp, int *terrno, int ns)
&& errno == EINVAL ? -1 : 1);
#endif
}
- if (__builtin_expect (__have_o_nonblock < 0, 0))
+ if (__glibc_unlikely (__have_o_nonblock < 0))
EXT(statp).nssocks[ns]
= socket(PF_INET, SOCK_DGRAM, 0);
slen = sizeof (struct sockaddr_in);
@@ -973,7 +973,7 @@ reopen (res_state statp, int *terrno, int ns)
__res_iclose(statp, false);
return (0);
}
- if (__builtin_expect (__have_o_nonblock < 0, 0)) {
+ if (__glibc_unlikely (__have_o_nonblock < 0)) {
/* Make socket non-blocking. */
int fl = __fcntl (EXT(statp).nssocks[ns], F_GETFL);
if (fl != -1)
@@ -1055,7 +1055,7 @@ send_dg(res_state statp,
n = 0;
if (nwritten == 0)
n = __poll (pfd, 1, 0);
- if (__builtin_expect (n == 0, 0)) {
+ if (__glibc_unlikely (n == 0)) {
n = __poll (pfd, 1, ptimeout);
need_recompute = 1;
}
@@ -1130,7 +1130,7 @@ send_dg(res_state statp,
reqs[1].msg_hdr.msg_controllen = 0;
int ndg = __sendmmsg (pfd[0].fd, reqs, 2, MSG_NOSIGNAL);
- if (__builtin_expect (ndg == 2, 1))
+ if (__glibc_likely (ndg == 2))
{
if (reqs[0].msg_len != buflen
|| reqs[1].msg_len != buflen2)
@@ -1146,7 +1146,7 @@ send_dg(res_state statp,
else
{
#ifndef __ASSUME_SENDMMSG
- if (__builtin_expect (have_sendmmsg == 0, 0))
+ if (__glibc_unlikely (have_sendmmsg == 0))
{
if (ndg < 0 && errno == ENOSYS)
{
@@ -1246,7 +1246,7 @@ send_dg(res_state statp,
*thisresplenp = recvfrom(pfd[0].fd, (char*)*thisansp,
*thisanssizp, 0,
(struct sockaddr *)&from, &fromlen);
- if (__builtin_expect (*thisresplenp <= 0, 0)) {
+ if (__glibc_unlikely (*thisresplenp <= 0)) {
if (errno == EINTR || errno == EAGAIN) {
need_recompute = 1;
goto wait;
@@ -1255,7 +1255,7 @@ send_dg(res_state statp,
goto err_out;
}
*gotsomewhere = 1;
- if (__builtin_expect (*thisresplenp < HFIXEDSZ, 0)) {
+ if (__glibc_unlikely (*thisresplenp < HFIXEDSZ)) {
/*
* Undersized message.
*/