diff options
author | Ondřej Bílka <neleai@seznam.cz> | 2014-02-10 14:45:42 +0100 |
---|---|---|
committer | Ondřej Bílka <neleai@seznam.cz> | 2014-02-10 15:07:12 +0100 |
commit | a1ffb40e32741f992c743e7b16c061fefa3747ac (patch) | |
tree | 246a29a87b26cfd5d07b17070f85eb3785018de9 /nis/nss_nis/nis-hosts.c | |
parent | 1448f3244714a9dabb5240ec18b094f100887d5c (diff) | |
download | glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.gz |
Use glibc_likely instead __builtin_expect.
Diffstat (limited to 'nis/nss_nis/nis-hosts.c')
-rw-r--r-- | nis/nss_nis/nis-hosts.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c index f73a0eccb2..462176ea03 100644 --- a/nis/nss_nis/nis-hosts.c +++ b/nis/nss_nis/nis-hosts.c @@ -136,14 +136,14 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer, int af, int flags) { char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct parser_data); buffer += pad; struct parser_data *data = (void *) buffer; - if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0)) + if (__glibc_unlikely (buflen < sizeof *data + 1 + pad)) { *errnop = ERANGE; *h_errnop = NETDB_INTERNAL; @@ -168,7 +168,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer, yperr = yp_next (domain, "hosts.byname", oldkey, oldkeylen, &outkey, &keylen, &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -188,7 +188,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer, return retval; } - if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > linebuflen)) { free (result); *h_errnop = NETDB_INTERNAL; @@ -203,7 +203,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer, free (result); parse_res = parse_line (p, host, data, buflen, errnop, af, flags); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) { free (outkey); *h_errnop = NETDB_INTERNAL; @@ -281,7 +281,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host, int len; int yperr = yp_match (domain, "hosts.byname", name2, namlen, &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -296,7 +296,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host, } const size_t linebuflen = buffer + buflen - data->linebuffer; - if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > linebuflen)) { free (result); *h_errnop = NETDB_INTERNAL; @@ -312,7 +312,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host, int parse_res = parse_line (p, host, data, buflen, errnop, af, flags); - if (__builtin_expect (parse_res < 1 || host->h_addrtype != af, 0)) + if (__glibc_unlikely (parse_res < 1 || host->h_addrtype != af)) { if (parse_res == -1) { @@ -373,14 +373,14 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af, int *errnop, int *h_errnop) { char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct parser_data); buffer += pad; struct parser_data *data = (void *) buffer; - if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0)) + if (__glibc_unlikely (buflen < sizeof *data + 1 + pad)) { *errnop = ERANGE; *h_errnop = NETDB_INTERNAL; @@ -395,7 +395,7 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af, int yperr = yp_match (domain, "hosts.byaddr", buf, strlen (buf), &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -411,7 +411,7 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af, } const size_t linebuflen = buffer + buflen - data->linebuffer; - if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > linebuflen)) { free (result); *errnop = ERANGE; @@ -428,7 +428,7 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af, int parse_res = parse_line (p, host, data, buflen, errnop, af, ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0)); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) { @@ -472,7 +472,7 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, int len; int yperr = yp_match (domain, "hosts.byname", name2, namlen, &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -493,7 +493,7 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, buffer += pad; buflen = buflen > pad ? buflen - pad : 0; - if (__builtin_expect (buflen < sizeof (struct gaih_addrtuple), 0)) + if (__glibc_unlikely (buflen < sizeof (struct gaih_addrtuple))) { erange: free (result); @@ -512,14 +512,14 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, struct parser_data *data = (void *) buffer; - if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0)) + if (__glibc_unlikely (buflen < sizeof *data + 1 + pad)) goto erange; buflen -= pad; struct hostent host; int parse_res = parse_line (result, &host, data, buflen, errnop, AF_UNSPEC, 0); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) { |