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 | |
parent | 1448f3244714a9dabb5240ec18b094f100887d5c (diff) | |
download | glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.gz glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.xz glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.zip |
Use glibc_likely instead __builtin_expect.
Diffstat (limited to 'nis')
39 files changed, 212 insertions, 212 deletions
diff --git a/nis/nis_call.c b/nis/nis_call.c index c437732c69..df926a3476 100644 --- a/nis/nis_call.c +++ b/nis/nis_call.c @@ -797,7 +797,7 @@ __prepare_niscall (const_nis_name name, directory_obj **dirp, dir_binding *bptrp, unsigned int flags) { nis_error retcode = __nisfind_server (name, 1, dirp, bptrp, flags); - if (__builtin_expect (retcode != NIS_SUCCESS, 0)) + if (__glibc_unlikely (retcode != NIS_SUCCESS)) return retcode; do diff --git a/nis/nis_callback.c b/nis/nis_callback.c index 958c49f122..e3527339a7 100644 --- a/nis/nis_callback.c +++ b/nis/nis_callback.c @@ -271,18 +271,18 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *, cb = (struct nis_cb *) calloc (1, sizeof (struct nis_cb) + sizeof (nis_server)); - if (__builtin_expect (cb == NULL, 0)) + if (__glibc_unlikely (cb == NULL)) goto failed; cb->serv = (nis_server *) (cb + 1); cb->serv->name = strdup (nis_local_principal ()); - if (__builtin_expect (cb->serv->name == NULL, 0)) + if (__glibc_unlikely (cb->serv->name == NULL)) goto failed; cb->serv->ep.ep_val = (endpoint *) calloc (2, sizeof (endpoint)); - if (__builtin_expect (cb->serv->ep.ep_val == NULL, 0)) + if (__glibc_unlikely (cb->serv->ep.ep_val == NULL)) goto failed; cb->serv->ep.ep_len = 1; cb->serv->ep.ep_val[0].family = strdup ("inet"); - if (__builtin_expect (cb->serv->ep.ep_val[0].family == NULL, 0)) + if (__glibc_unlikely (cb->serv->ep.ep_val[0].family == NULL)) goto failed; cb->callback = callback; cb->userdata = userdata; @@ -314,7 +314,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *, } cb->serv->ep.ep_val[0].proto = strdup ((flags & USE_DGRAM) ? "udp" : "tcp"); - if (__builtin_expect (cb->serv->ep.ep_val[0].proto == NULL, 0)) + if (__glibc_unlikely (cb->serv->ep.ep_val[0].proto == NULL)) goto failed; cb->xprt = ((flags & USE_DGRAM) ? svcudp_bufcreate (sock, 100, 8192) diff --git a/nis/nis_creategroup.c b/nis/nis_creategroup.c index a9167348c3..dd7f317b82 100644 --- a/nis/nis_creategroup.c +++ b/nis/nis_creategroup.c @@ -46,7 +46,7 @@ nis_creategroup (const_nis_name group, unsigned int flags) return NIS_BADNAME; obj = calloc (1, sizeof (nis_object)); - if (__builtin_expect (obj == NULL, 0)) + if (__glibc_unlikely (obj == NULL)) return NIS_NOMEMORY; obj->zo_oid.ctime = obj->zo_oid.mtime = time (NULL); diff --git a/nis/nis_domain_of_r.c b/nis/nis_domain_of_r.c index 52af9cc9cd..5216f49434 100644 --- a/nis/nis_domain_of_r.c +++ b/nis/nis_domain_of_r.c @@ -50,7 +50,7 @@ nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen) return strcpy (buffer, "."); } - if (__builtin_expect (cptr_len >= buflen, 0)) + if (__glibc_unlikely (cptr_len >= buflen)) { __set_errno (ERANGE); return NULL; diff --git a/nis/nis_findserv.c b/nis/nis_findserv.c index b566425015..8adad82e1e 100644 --- a/nis/nis_findserv.c +++ b/nis/nis_findserv.c @@ -89,7 +89,7 @@ __nis_findfastest_with_timeout (dir_binding *bind, pings = malloc (sizeof (struct findserv_req) * pings_max); xid_seed = (u_int32_t) (time (NULL) ^ getpid ()); - if (__builtin_expect (pings == NULL, 0)) + if (__glibc_unlikely (pings == NULL)) return -1; memset (&sin, '\0', sizeof (sin)); @@ -118,7 +118,7 @@ __nis_findfastest_with_timeout (dir_binding *bind, pings_max += 10; new_pings = realloc (pings, sizeof (struct findserv_req) * pings_max); - if (__builtin_expect (new_pings == NULL, 0)) + if (__glibc_unlikely (new_pings == NULL)) { free (pings); return -1; diff --git a/nis/nis_getservlist.c b/nis/nis_getservlist.c index ac9278e227..f180bad0dd 100644 --- a/nis/nis_getservlist.c +++ b/nis/nis_getservlist.c @@ -38,7 +38,7 @@ nis_getservlist (const_nis_name dir) serv = malloc (sizeof (nis_server *) * (NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_len + 1)); - if (__builtin_expect (serv == NULL, 0)) + if (__glibc_unlikely (serv == NULL)) { nis_freeresult (res); return NULL; @@ -50,7 +50,7 @@ nis_getservlist (const_nis_name dir) server = &NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_val[i]; serv[i] = calloc (1, sizeof (nis_server)); - if (__builtin_expect (serv[i] == NULL, 0)) + if (__glibc_unlikely (serv[i] == NULL)) { free_all: while (i-- > 0) @@ -81,7 +81,7 @@ nis_getservlist (const_nis_name dir) if (server->name != NULL) { serv[i]->name = strdup (server->name); - if (__builtin_expect (serv[i]->name == NULL, 0)) + if (__glibc_unlikely (serv[i]->name == NULL)) { ++i; goto free_all; @@ -95,7 +95,7 @@ nis_getservlist (const_nis_name dir) serv[i]->ep.ep_val = malloc (server->ep.ep_len * sizeof (endpoint)); - if (__builtin_expect (serv[i]->ep.ep_val == NULL, 0)) + if (__glibc_unlikely (serv[i]->ep.ep_val == NULL)) { ++i; goto free_all; @@ -126,7 +126,7 @@ nis_getservlist (const_nis_name dir) if (server->pkey.n_len > 0) { serv[i]->pkey.n_bytes = malloc (server->pkey.n_len); - if (__builtin_expect (serv[i]->pkey.n_bytes == NULL, 0)) + if (__glibc_unlikely (serv[i]->pkey.n_bytes == NULL)) { ++i; goto free_all; @@ -140,7 +140,7 @@ nis_getservlist (const_nis_name dir) else { serv = malloc (sizeof (nis_server *)); - if (__builtin_expect (serv != NULL, 0)) + if (__glibc_unlikely (serv != NULL)) serv[0] = NULL; } diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c index a41f121855..b9096c9ea4 100644 --- a/nis/nis_lookup.c +++ b/nis/nis_lookup.c @@ -63,7 +63,7 @@ nis_lookup (const_nis_name name, const unsigned int flags) req.ns_object.ns_object_val = NULL; status = __prepare_niscall (req.ns_name, &dir, &bptr, flags); - if (__builtin_expect (status != NIS_SUCCESS, 0)) + if (__glibc_unlikely (status != NIS_SUCCESS)) { NIS_RES_STATUS (res) = status; goto out; @@ -147,7 +147,7 @@ nis_lookup (const_nis_name name, const unsigned int flags) dir = NULL; status = __prepare_niscall (req.ns_name, &dir, &bptr, flags); - if (__builtin_expect (status != NIS_SUCCESS, 0)) + if (__glibc_unlikely (status != NIS_SUCCESS)) { NIS_RES_STATUS (res) = status; goto out; diff --git a/nis/nis_subr.c b/nis/nis_subr.c index 4a4580a1e6..8f6f1d71f3 100644 --- a/nis/nis_subr.c +++ b/nis/nis_subr.c @@ -38,7 +38,7 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen) while (name[i] != '.' && name[i] != '\0') i++; - if (__builtin_expect (i >= buflen, 0)) + if (__glibc_unlikely (i >= buflen)) { __set_errno (ERANGE); return NULL; @@ -118,7 +118,7 @@ nis_getnames (const_nis_name name) int count = 2; nis_name *getnames = malloc ((count + 1) * sizeof (char *)); - if (__builtin_expect (getnames == NULL, 0)) + if (__glibc_unlikely (getnames == NULL)) return NULL; /* Do we have a fully qualified NIS+ name ? If yes, give it back */ @@ -200,12 +200,12 @@ nis_getnames (const_nis_name name) count += 5; nis_name *newp = realloc (getnames, (count + 1) * sizeof (char *)); - if (__builtin_expect (newp == NULL, 0)) + if (__glibc_unlikely (newp == NULL)) goto free_null; getnames = newp; } tmp = malloc (strlen (cptr) + local_domain_len + name_len + 2); - if (__builtin_expect (tmp == NULL, 0)) + if (__glibc_unlikely (tmp == NULL)) goto free_null; getnames[pos] = tmp; @@ -235,7 +235,7 @@ nis_getnames (const_nis_name name) char *p; tmp = malloc (cplen + local_domain_len + name_len + 2); - if (__builtin_expect (tmp == NULL, 0)) + if (__glibc_unlikely (tmp == NULL)) goto free_null; p = __stpcpy (tmp, name); @@ -251,7 +251,7 @@ nis_getnames (const_nis_name name) char *p; tmp = malloc (cplen + name_len + 3); - if (__builtin_expect (tmp == NULL, 0)) + if (__glibc_unlikely (tmp == NULL)) goto free_null; p = __mempcpy (tmp, name, name_len); @@ -267,7 +267,7 @@ nis_getnames (const_nis_name name) count += 5; nis_name *newp = realloc (getnames, (count + 1) * sizeof (char *)); - if (__builtin_expect (newp == NULL, 0)) + if (__glibc_unlikely (newp == NULL)) goto free_null; getnames = newp; } diff --git a/nis/nis_table.c b/nis/nis_table.c index 9344a1f7b3..bb74873d9d 100644 --- a/nis/nis_table.c +++ b/nis/nis_table.c @@ -92,7 +92,7 @@ __create_ib_request (const_nis_name name, unsigned int flags) if (cptr != NULL) *cptr++ = '\0'; - if (__builtin_expect (val == NULL, 0)) + if (__glibc_unlikely (val == NULL)) { nis_free_request (ibreq); return NULL; @@ -282,7 +282,7 @@ nis_list (const_nis_name name, unsigned int flags, } while (__nisbind_connect (&bptr) != NIS_SUCCESS) - if (__builtin_expect (__nisbind_next (&bptr) != NIS_SUCCESS, 0)) + if (__glibc_unlikely (__nisbind_next (&bptr) != NIS_SUCCESS)) { NIS_RES_STATUS (res) = NIS_NAMEUNREACHABLE; goto fail; @@ -302,7 +302,7 @@ nis_list (const_nis_name name, unsigned int flags, (xdrproc_t) _xdr_nis_result, (caddr_t) res, RPCTIMEOUT); - if (__builtin_expect (clnt_status != RPC_SUCCESS, 0)) + if (__glibc_unlikely (clnt_status != RPC_SUCCESS)) NIS_RES_STATUS (res) = NIS_RPCERROR; else switch (NIS_RES_STATUS (res)) @@ -316,7 +316,7 @@ nis_list (const_nis_name name, unsigned int flags, free (ibreq->ibr_name); ibreq->ibr_name = NULL; /* If we hit the link limit, bail. */ - if (__builtin_expect (count_links > NIS_MAXLINKS, 0)) + if (__glibc_unlikely (count_links > NIS_MAXLINKS)) { NIS_RES_STATUS (res) = NIS_LINKNAMEERROR; ++done; @@ -491,7 +491,7 @@ nis_list (const_nis_name name, unsigned int flags, /* Try the next domainname if we don't follow a link. */ free (ibreq->ibr_name); ibreq->ibr_name = NULL; - if (__builtin_expect (count_links, 0)) + if (__glibc_unlikely (count_links)) { NIS_RES_STATUS (res) = NIS_LINKNAMEERROR; ++done; @@ -597,7 +597,7 @@ nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags) (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result, (caddr_t) res, 0, NULL); - if (__builtin_expect (status != NIS_SUCCESS, 0)) + if (__glibc_unlikely (status != NIS_SUCCESS)) NIS_RES_STATUS (res) = status; nis_free_request (ibreq); @@ -654,7 +654,7 @@ nis_modify_entry (const_nis_name name, const nis_object *obj2, (xdrproc_t) _xdr_ib_request, (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result, (caddr_t) res, 0, NULL); - if (__builtin_expect (status != NIS_SUCCESS, 0)) + if (__glibc_unlikely (status != NIS_SUCCESS)) NIS_RES_STATUS (res) = status; nis_free_request (ibreq); @@ -739,7 +739,7 @@ nis_first_entry (const_nis_name name) (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result, (caddr_t) res, 0, NULL); - if (__builtin_expect (status != NIS_SUCCESS, 0)) + if (__glibc_unlikely (status != NIS_SUCCESS)) NIS_RES_STATUS (res) = status; nis_free_request (ibreq); @@ -782,7 +782,7 @@ nis_next_entry (const_nis_name name, const netobj *cookie) (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result, (caddr_t) res, 0, NULL); - if (__builtin_expect (status != NIS_SUCCESS, 0)) + if (__glibc_unlikely (status != NIS_SUCCESS)) NIS_RES_STATUS (res) = status; if (cookie != NULL) diff --git a/nis/nis_xdr.c b/nis/nis_xdr.c index d7ca81910e..c391d9c280 100644 --- a/nis/nis_xdr.c +++ b/nis/nis_xdr.c @@ -75,7 +75,7 @@ xdr_endpoint (XDR *xdrs, endpoint *objp) if (__builtin_expect (res, TRUE)) { res = xdr_string (xdrs, &objp->family, ~0); - if (__builtin_expect (res, 1)) + if (__glibc_likely (res)) res = xdr_string (xdrs, &objp->proto, ~0); } return res; diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c index 2d57461fed..78e14d6d3c 100644 --- a/nis/nss_compat/compat-grp.c +++ b/nis/nss_compat/compat-grp.c @@ -288,7 +288,7 @@ getgrent_next_file (struct group *result, ent_t *ent, do { /* We need at least 3 characters for one line. */ - if (__builtin_expect (buflen < 3, 0)) + if (__glibc_unlikely (buflen < 3)) { erange: *errnop = ERANGE; @@ -321,7 +321,7 @@ getgrent_next_file (struct group *result, ent_t *ent, !(parse_res = _nss_files_parse_grent (p, result, data, buflen, errnop))); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) /* The parser ran out of space. */ goto erange_reset; @@ -421,7 +421,7 @@ internal_getgrnam_r (const char *name, struct group *result, ent_t *ent, do { /* We need at least 3 characters for one line. */ - if (__builtin_expect (buflen < 3, 0)) + if (__glibc_unlikely (buflen < 3)) { erange: *errnop = ERANGE; @@ -454,7 +454,7 @@ internal_getgrnam_r (const char *name, struct group *result, ent_t *ent, !(parse_res = _nss_files_parse_grent (p, result, data, buflen, errnop))); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) /* The parser ran out of space. */ goto erange_reset; @@ -552,7 +552,7 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent, do { /* We need at least 3 characters for one line. */ - if (__builtin_expect (buflen < 3, 0)) + if (__glibc_unlikely (buflen < 3)) { erange: *errnop = ERANGE; @@ -585,7 +585,7 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent, !(parse_res = _nss_files_parse_grent (p, result, data, buflen, errnop))); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) /* The parser ran out of space. */ goto erange_reset; diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c index fa1523891e..c5ba606e1c 100644 --- a/nis/nss_compat/compat-initgroups.c +++ b/nis/nss_compat/compat-initgroups.c @@ -214,7 +214,7 @@ add_group (long int *start, long int *size, gid_t **groupsp, long int limit, gid_t *groups = *groupsp; /* Matches user. Insert this group. */ - if (__builtin_expect (*start == *size, 0)) + if (__glibc_unlikely (*start == *size)) { /* Need a bigger buffer. */ gid_t *newgroups; @@ -420,7 +420,7 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user, do { /* We need at least 3 characters for one line. */ - if (__builtin_expect (buflen < 3, 0)) + if (__glibc_unlikely (buflen < 3)) { erange: *errnop = ERANGE; @@ -453,7 +453,7 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user, !(parse_res = _nss_files_parse_grent (p, &grpbuf, data, buflen, errnop))); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) /* The parser ran out of space. */ goto erange_reset; diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c index 021fb18d19..127673c596 100644 --- a/nis/nss_compat/compat-pwd.c +++ b/nis/nss_compat/compat-pwd.c @@ -528,7 +528,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent, do { /* We need at least 3 characters for one line. */ - if (__builtin_expect (buflen < 3, 0)) + if (__glibc_unlikely (buflen < 3)) { erange: *errnop = ERANGE; @@ -561,7 +561,7 @@ getpwent_next_file (struct passwd *result, ent_t *ent, !(parse_res = _nss_files_parse_pwent (p, result, data, buflen, errnop))); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) /* The parser ran out of space. */ goto erange_reset; @@ -727,7 +727,7 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent, do { /* We need at least 3 characters for one line. */ - if (__builtin_expect (buflen < 3, 0)) + if (__glibc_unlikely (buflen < 3)) { erange: *errnop = ERANGE; @@ -761,7 +761,7 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent, !(parse_res = _nss_files_parse_pwent (p, result, data, buflen, errnop))); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) /* The parser ran out of space. */ goto erange_reset; @@ -934,7 +934,7 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent, do { /* We need at least 3 characters for one line. */ - if (__builtin_expect (buflen < 3, 0)) + if (__glibc_unlikely (buflen < 3)) { erange: *errnop = ERANGE; @@ -967,7 +967,7 @@ internal_getpwuid_r (uid_t uid, struct passwd *result, ent_t *ent, !(parse_res = _nss_files_parse_pwent (p, result, data, buflen, errnop))); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) /* The parser ran out of space. */ goto erange_reset; diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c index 1c2ec3d875..4890ce6f90 100644 --- a/nis/nss_compat/compat-spwd.c +++ b/nis/nss_compat/compat-spwd.c @@ -485,7 +485,7 @@ getspent_next_file (struct spwd *result, ent_t *ent, do { /* We need at least 3 characters for one line. */ - if (__builtin_expect (buflen < 3, 0)) + if (__glibc_unlikely (buflen < 3)) { erange: *errnop = ERANGE; @@ -515,7 +515,7 @@ getspent_next_file (struct spwd *result, ent_t *ent, || !(parse_res = _nss_files_parse_spent (p, result, data, buflen, errnop))); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) /* The parser ran out of space. */ goto erange_reset; @@ -685,7 +685,7 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent, do { /* We need at least 3 characters for one line. */ - if (__builtin_expect (buflen < 3, 0)) + if (__glibc_unlikely (buflen < 3)) { erange: *errnop = ERANGE; @@ -718,7 +718,7 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent, !(parse_res = _nss_files_parse_spent (p, result, data, buflen, errnop))); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) /* The parser ran out of space. */ goto erange_reset; diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c index 2f708c185c..995e610859 100644 --- a/nis/nss_nis/nis-alias.c +++ b/nis/nss_nis/nis-alias.c @@ -125,7 +125,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer, { char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; alias->alias_local = 0; @@ -147,7 +147,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer, yperr = yp_next (domain, "mail.aliases", 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); @@ -156,7 +156,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer, return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -170,7 +170,7 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer, parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer, buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) { free (outkey); *errnop = ERANGE; @@ -213,7 +213,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias, } char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; size_t namlen = strlen (name); @@ -244,7 +244,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias, if (!use_alloca) free (name2); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -253,7 +253,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias, return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -269,7 +269,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias, alias->alias_local = 0; int parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c index a803c27ac6..59190cf5fa 100644 --- a/nis/nss_nis/nis-ethers.c +++ b/nis/nss_nis/nis-ethers.c @@ -188,7 +188,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth, } char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; char *result; @@ -196,7 +196,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth, int yperr = yp_match (domain, "ethers.byname", name, strlen (name), &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -205,7 +205,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth, return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -220,7 +220,7 @@ _nss_nis_gethostton_r (const char *name, struct etherent *eth, int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; @@ -241,7 +241,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth, } char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; char buf[33]; @@ -257,7 +257,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth, int len; int yperr = yp_match (domain, "ethers.byaddr", buf, nlen, &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -266,7 +266,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth, return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -281,7 +281,7 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth, int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c index 53368073a7..20211de0de 100644 --- a/nis/nss_nis/nis-grp.c +++ b/nis/nss_nis/nis-grp.c @@ -85,7 +85,7 @@ internal_nis_setgrent (void) { /* We have to read all the data now. */ char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; struct ypall_callback ypcb; @@ -152,7 +152,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen, handle_batch_read: bucket = intern.next; - if (__builtin_expect (intern.offset >= bucket->size, 0)) + if (__glibc_unlikely (intern.offset >= bucket->size)) { if (bucket->next == NULL) return NSS_STATUS_NOTFOUND; @@ -191,7 +191,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen, yperr = yp_next (domain, "group.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); @@ -201,7 +201,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen, } } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { if (!batch_read) free (result); @@ -218,7 +218,7 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen, parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) { if (!batch_read) free (outkey); @@ -267,7 +267,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp, } char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; char *result; @@ -275,7 +275,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp, int yperr = yp_match (domain, "group.byname", name, strlen (name), &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -284,7 +284,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp, return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -314,7 +314,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp, char *buffer, size_t buflen, int *errnop) { char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; char buf[32]; @@ -324,7 +324,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp, int len; int yperr = yp_match (domain, "group.bygid", buf, nlen, &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -333,7 +333,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp, return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -348,7 +348,7 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp, int parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; 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) { diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c index 30bc90f691..e8fcca1bb1 100644 --- a/nis/nss_nis/nis-initgroups.c +++ b/nis/nss_nis/nis-initgroups.c @@ -72,7 +72,7 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen, { struct response_t *bucket = intern->next; - if (__builtin_expect (intern->offset >= bucket->size, 0)) + if (__glibc_unlikely (intern->offset >= bucket->size)) { if (bucket->next == NULL) return NSS_STATUS_NOTFOUND; @@ -88,7 +88,7 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen, ++intern->offset; size_t len = strlen (p) + 1; - if (__builtin_expect (len > buflen, 0)) + if (__glibc_unlikely (len > buflen)) { *errnop = ERANGE; return NSS_STATUS_TRYAGAIN; @@ -106,7 +106,7 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen, parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) return NSS_STATUS_TRYAGAIN; intern->offset += len; @@ -160,7 +160,7 @@ initgroups_netid (uid_t uid, gid_t group, long int *start, long int *size, int reslen; int yperr = yp_match (domainname, "netid.byname", key, keylen, &result, &reslen); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) return yperr2nss (yperr); /* Parse the result: following the colon is a comma separated list of diff --git a/nis/nss_nis/nis-netgrp.c b/nis/nss_nis/nis-netgrp.c index d4b2e569d3..d03d71593f 100644 --- a/nis/nss_nis/nis-netgrp.c +++ b/nis/nss_nis/nis-netgrp.c @@ -54,16 +54,16 @@ _nss_nis_setnetgrent (const char *group, struct __netgrent *netgrp) status = NSS_STATUS_SUCCESS; - if (__builtin_expect (group == NULL || group[0] == '\0', 0)) + if (__glibc_unlikely (group == NULL || group[0] == '\0')) return NSS_STATUS_UNAVAIL; char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; status = yperr2nss (yp_match (domain, "netgroup", group, strlen (group), &netgrp->data, &len)); - if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1)) + if (__glibc_likely (status == NSS_STATUS_SUCCESS)) { /* Our implementation of yp_match already allocates a buffer which is one byte larger than the value in LEN specifies diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c index da28860003..f28fbdaa4f 100644 --- a/nis/nss_nis/nis-network.c +++ b/nis/nss_nis/nis-network.c @@ -74,7 +74,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen, struct parser_data *data = (void *) buffer; char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; /* Get the next entry until we found a correct one. */ @@ -94,7 +94,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen, yperr = yp_next (domain, "networks.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); @@ -106,7 +106,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen, return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -121,7 +121,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen, free (result); parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) { free (outkey); *herrnop = NETDB_INTERNAL; @@ -166,7 +166,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer, } char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; struct parser_data *data = (void *) buffer; @@ -191,7 +191,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer, int yperr = yp_match (domain, "networks.byname", name2, namlen, &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -203,7 +203,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer, return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -219,7 +219,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer, int parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { *herrnop = NETDB_INTERNAL; if (parse_res == -1) @@ -237,7 +237,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net, int *herrnop) { char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; struct in_addr in = { .s_addr = htonl (addr) }; @@ -252,7 +252,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net, int yperr = yp_match (domain, "networks.byaddr", buf, blen, &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -277,7 +277,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net, } } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -294,7 +294,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net, int parse_res = _nss_files_parse_netent (p, net, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { *herrnop = NETDB_INTERNAL; if (parse_res == -1) diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c index eff2eddd6c..e165f10200 100644 --- a/nis/nss_nis/nis-proto.c +++ b/nis/nss_nis/nis-proto.c @@ -185,7 +185,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto, } char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; char *result; @@ -193,7 +193,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto, int yperr = yp_match (domain, "protocols.byname", name, strlen (name), &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -202,7 +202,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto, return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -217,7 +217,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto, int parse_res = _nss_files_parse_protoent (p, proto, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; @@ -232,7 +232,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto, char *buffer, size_t buflen, int *errnop) { char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; char buf[32]; @@ -243,7 +243,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto, int yperr = yp_match (domain, "protocols.bynumber", buf, nlen, &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -252,7 +252,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto, return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -267,7 +267,7 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto, int parse_res = _nss_files_parse_protoent (p, proto, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; diff --git a/nis/nss_nis/nis-publickey.c b/nis/nss_nis/nis-publickey.c index cec43e2b24..7a133418ef 100644 --- a/nis/nss_nis/nis-publickey.c +++ b/nis/nss_nis/nis-publickey.c @@ -56,7 +56,7 @@ _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop) int yperr = yp_match (domain, "publickey.byname", netname, strlen (netname), &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -102,7 +102,7 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd, int yperr = yp_match (domain, "publickey.byname", netname, strlen (netname), &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c index 6726efde57..aab14c64df 100644 --- a/nis/nss_nis/nis-pwd.c +++ b/nis/nss_nis/nis-pwd.c @@ -57,7 +57,7 @@ _nis_saveit (int instatus, char *inkey, int inkeylen, char *inval, { struct response_t *bucket = intern->next; - if (__builtin_expect (bucket == NULL, 0)) + if (__glibc_unlikely (bucket == NULL)) { #define MINSIZE 4096 - 4 * sizeof (void *) const size_t minsize = MAX (MINSIZE, 2 * (invallen + 1)); @@ -92,7 +92,7 @@ _nis_saveit (int instatus, char *inkey, int inkeylen, char *inval, } char *p = mempcpy (&bucket->mem[intern->offset], inval, invallen); - if (__builtin_expect (p[-1] != '\0', 0)) + if (__glibc_unlikely (p[-1] != '\0')) { *p = '\0'; ++invallen; @@ -143,7 +143,7 @@ internal_nis_setpwent (void) { /* We have to read all the data now. */ char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; struct ypall_callback ypcb; @@ -210,7 +210,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen, handle_batch_read: bucket = intern.next; - if (__builtin_expect (intern.offset >= bucket->size, 0)) + if (__glibc_unlikely (intern.offset >= bucket->size)) { if (bucket->next == NULL) return NSS_STATUS_NOTFOUND; @@ -249,7 +249,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen, yperr = yp_next (domain, "passwd.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); @@ -312,7 +312,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen, else { non_adjunct: - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -330,7 +330,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen, parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) { if (!batch_read) free (outkey); @@ -379,7 +379,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd, } char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; size_t namelen = strlen (name); @@ -388,7 +388,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd, int len; int yperr = yp_match (domain, "passwd.byname", name, namelen, &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -447,7 +447,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd, else { non_adjunct: - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -464,7 +464,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd, int parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; @@ -480,7 +480,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd, char *buffer, size_t buflen, int *errnop) { char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; char buf[32]; @@ -490,7 +490,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd, int len; int yperr = yp_match (domain, "passwd.byuid", buf, nlen, &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -552,7 +552,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd, else { non_adjunct: - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -569,7 +569,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd, int parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c index a2fff630c4..cb4b0895c6 100644 --- a/nis/nss_nis/nis-rpc.c +++ b/nis/nss_nis/nis-rpc.c @@ -124,7 +124,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen, { struct response_t *bucket = intern->next; - if (__builtin_expect (intern->offset >= bucket->size, 0)) + if (__glibc_unlikely (intern->offset >= bucket->size)) { if (bucket->next == NULL) return NSS_STATUS_NOTFOUND; @@ -139,7 +139,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen, ++intern->offset; size_t len = strlen (p) + 1; - if (__builtin_expect (len > buflen, 0)) + if (__glibc_unlikely (len > buflen)) { *errnop = ERANGE; return NSS_STATUS_TRYAGAIN; @@ -156,7 +156,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen, p = memcpy (buffer, &bucket->mem[intern->offset], len); parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) return NSS_STATUS_TRYAGAIN; intern->offset += len; @@ -193,7 +193,7 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc, intern_t data = { NULL, NULL, 0 }; enum nss_status status = internal_nis_setrpcent (&data); - if (__builtin_expect (status != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (status != NSS_STATUS_SUCCESS)) return status; int found = 0; @@ -222,7 +222,7 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc, internal_nis_endrpcent (&data); - if (__builtin_expect (!found && status == NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (!found && status == NSS_STATUS_SUCCESS)) return NSS_STATUS_NOTFOUND; return status; @@ -233,7 +233,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc, char *buffer, size_t buflen, int *errnop) { char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; char buf[32]; @@ -243,7 +243,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc, int len; int yperr = yp_match (domain, "rpc.bynumber", buf, nlen, &result, &len); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -252,7 +252,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc, return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -267,7 +267,7 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc, int parse_res = _nss_files_parse_rpcent (p, rpc, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c index fd79d3fe07..f9b4a86d76 100644 --- a/nis/nss_nis/nis-service.c +++ b/nis/nss_nis/nis-service.c @@ -56,12 +56,12 @@ dosearch (int instatus, char *inkey, int inkeylen, char *inval, { struct search_t *req = (struct search_t *) indata; - if (__builtin_expect (instatus != YP_TRUE, 0)) + if (__glibc_unlikely (instatus != YP_TRUE)) return 1; if (inkey && inkeylen > 0 && inval && invallen > 0) { - if (__builtin_expect ((size_t) (invallen + 1) > req->buflen, 0)) + if (__glibc_unlikely ((size_t) (invallen + 1) > req->buflen)) { *req->errnop = ERANGE; req->status = NSS_STATUS_TRYAGAIN; @@ -196,7 +196,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer, { struct response_t *bucket = intern.next; - if (__builtin_expect (intern.offset >= bucket->size, 0)) + if (__glibc_unlikely (intern.offset >= bucket->size)) { if (bucket->next == NULL) return NSS_STATUS_NOTFOUND; @@ -211,7 +211,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer, ++intern.offset; size_t len = strlen (p) + 1; - if (__builtin_expect (len > buflen, 0)) + if (__glibc_unlikely (len > buflen)) { *errnop = ERANGE; return NSS_STATUS_TRYAGAIN; @@ -228,7 +228,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer, p = memcpy (buffer, &bucket->mem[intern.offset], len); parse_res = _nss_files_parse_servent (p, serv, pdata, buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) return NSS_STATUS_TRYAGAIN; intern.offset += len; @@ -265,7 +265,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol, } char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; /* If the protocol is given, we could try if our NIS server knows @@ -289,9 +289,9 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol, /* If we found the key, it's ok and parse the result. If not, fall through and parse the complete table. */ - if (__builtin_expect (status == YPERR_SUCCESS, 1)) + if (__glibc_likely (status == YPERR_SUCCESS)) { - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -306,7 +306,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol, int parse_res = _nss_files_parse_servent (p, serv, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 0, 0)) + if (__glibc_unlikely (parse_res < 0)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; @@ -336,7 +336,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol, req.status = NSS_STATUS_NOTFOUND; status = yp_all (domain, "services.byname", &ypcb); - if (__builtin_expect (status != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (status != YPERR_SUCCESS)) return yperr2nss (status); return req.status; @@ -348,7 +348,7 @@ _nss_nis_getservbyport_r (int port, const char *protocol, size_t buflen, int *errnop) { char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; /* If the protocol is given, we only need one query. @@ -370,9 +370,9 @@ _nss_nis_getservbyport_r (int port, const char *protocol, /* If we found the key, it's ok and parse the result. If not, fall through and parse the complete table. */ - if (__builtin_expect (status == YPERR_SUCCESS, 1)) + if (__glibc_likely (status == YPERR_SUCCESS)) { - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + 1) > buflen)) { free (result); *errnop = ERANGE; @@ -386,7 +386,7 @@ _nss_nis_getservbyport_r (int port, const char *protocol, free (result); int parse_res = _nss_files_parse_servent (p, serv, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 0, 0)) + if (__glibc_unlikely (parse_res < 0)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; @@ -417,7 +417,7 @@ _nss_nis_getservbyport_r (int port, const char *protocol, req.status = NSS_STATUS_NOTFOUND; int status = yp_all (domain, "services.byname", &ypcb); - if (__builtin_expect (status != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (status != YPERR_SUCCESS)) return yperr2nss (status); return req.status; diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c index d024c0d22c..7cfc3ce617 100644 --- a/nis/nss_nis/nis-spwd.c +++ b/nis/nss_nis/nis-spwd.c @@ -71,7 +71,7 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen, int *errnop) { char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; /* Get the next entry until we found a correct one. */ @@ -102,7 +102,7 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen, ? "passwd.adjunct.byname" : "shadow.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); @@ -177,7 +177,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp, const size_t name_len = strlen (name); char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (__glibc_unlikely (yp_get_default_domain (&domain))) return NSS_STATUS_UNAVAIL; bool adjunct_used = false; @@ -194,7 +194,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp, adjunct_used = true; } - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (__glibc_unlikely (yperr != YPERR_SUCCESS)) { enum nss_status retval = yperr2nss (yperr); @@ -203,7 +203,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp, return retval; } - if (__builtin_expect ((size_t) (len + (adjunct_used ? 3 : 1)) > buflen, 0)) + if (__glibc_unlikely ((size_t) (len + (adjunct_used ? 3 : 1)) > buflen)) { free (result); *errnop = ERANGE; @@ -224,7 +224,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp, int parse_res = _nss_files_parse_spent (p, sp, (void *) buffer, buflen, errnop); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c index e3a82ffc49..9e3849bd65 100644 --- a/nis/nss_nisplus/nisplus-alias.c +++ b/nis/nss_nisplus/nisplus-alias.c @@ -310,7 +310,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); nis_freeresult (result); @@ -323,7 +323,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias, /* We do not need the lookup result anymore. */ nis_freeresult (result); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { __set_errno (olderr); diff --git a/nis/nss_nisplus/nisplus-ethers.c b/nis/nss_nisplus/nisplus-ethers.c index cc7695f037..a962166bd3 100644 --- a/nis/nss_nisplus/nisplus-ethers.c +++ b/nis/nss_nisplus/nisplus-ethers.c @@ -264,7 +264,7 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); nis_freeresult (result); @@ -277,7 +277,7 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth, /* We do not need the lookup result anymore. */ nis_freeresult (result); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { __set_errno (olderr); @@ -331,7 +331,7 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr, struct etherent *eth, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); nis_freeresult (result); @@ -344,7 +344,7 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr, struct etherent *eth, /* We do not need the lookup result anymore. */ nis_freeresult (result); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; diff --git a/nis/nss_nisplus/nisplus-grp.c b/nis/nss_nisplus/nisplus-grp.c index 8667532977..58f31c8c2b 100644 --- a/nis/nss_nisplus/nisplus-grp.c +++ b/nis/nss_nisplus/nisplus-grp.c @@ -242,7 +242,7 @@ internal_nisplus_getgrent_r (struct group *gr, char *buffer, size_t buflen, parse_res = _nss_nisplus_parse_grent (&result, gr, buffer, buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) { *errnop = ERANGE; retval = NSS_STATUS_TRYAGAIN; @@ -316,7 +316,7 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); @@ -326,7 +326,7 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr, parse_res = _nss_nisplus_parse_grent (result, gr, buffer, buflen, errnop); nis_freeresult (result); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) { @@ -371,7 +371,7 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); @@ -384,7 +384,7 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr, parse_res = _nss_nisplus_parse_grent (result, gr, buffer, buflen, errnop); nis_freeresult (result); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { __set_errno (olderr); diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c index 62440f2459..b3e0df5883 100644 --- a/nis/nss_nisplus/nisplus-hosts.c +++ b/nis/nss_nisplus/nisplus-hosts.c @@ -439,7 +439,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host, } int retval = niserr2nss (result->status); - if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS)) { if (retval == NSS_STATUS_TRYAGAIN) { @@ -543,7 +543,7 @@ _nss_nisplus_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af, } retval = niserr2nss (result->status); - if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS)) { if (retval == NSS_STATUS_TRYAGAIN) { @@ -587,7 +587,7 @@ _nss_nisplus_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, enum nss_status status = internal_gethostbyname2_r (name, AF_UNSPEC, &host, buffer, buflen, errnop, herrnop, 0); - if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1)) + if (__glibc_likely (status == NSS_STATUS_SUCCESS)) { if (*pat == NULL) { @@ -596,7 +596,7 @@ _nss_nisplus_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))) { free (result); *errnop = ERANGE; diff --git a/nis/nss_nisplus/nisplus-initgroups.c b/nis/nss_nisplus/nisplus-initgroups.c index 9df9643a28..c304f0e18c 100644 --- a/nis/nss_nisplus/nisplus-initgroups.c +++ b/nis/nss_nisplus/nisplus-initgroups.c @@ -67,7 +67,7 @@ _nss_nisplus_initgroups_dyn (const char *user, gid_t group, long int *start, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); @@ -98,7 +98,7 @@ _nss_nisplus_initgroups_dyn (const char *user, gid_t group, long int *start, gid_t gid; char *endp; - if (__builtin_expect (numstr[len - 1] != '\0', 0)) + if (__glibc_unlikely (numstr[len - 1] != '\0')) { char numstrbuf[len + 1]; memcpy (numstrbuf, numstr, len); diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c index ed4a8f35e4..43e955d14e 100644 --- a/nis/nss_nisplus/nisplus-network.c +++ b/nis/nss_nisplus/nisplus-network.c @@ -376,7 +376,7 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network, } retval = niserr2nss (result->status); - if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS)) { if (retval == NSS_STATUS_TRYAGAIN) { @@ -447,7 +447,7 @@ _nss_nisplus_getnetbyaddr_r (uint32_t addr, const int type, return NSS_STATUS_TRYAGAIN; } enum nss_status retval = niserr2nss (result->status); - if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (retval != NSS_STATUS_SUCCESS)) { if (b2len > 2 && buf2[b2len - 2] == '.' && buf2[b2len - 1] == '0') { diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c index 358d7de216..cfe32f5fa7 100644 --- a/nis/nss_nisplus/nisplus-proto.c +++ b/nis/nss_nisplus/nisplus-proto.c @@ -347,7 +347,7 @@ _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); @@ -408,7 +408,7 @@ _nss_nisplus_getprotobynumber_r (const int number, struct protoent *proto, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c index 1a732bc813..811131c0ad 100644 --- a/nis/nss_nisplus/nisplus-pwd.c +++ b/nis/nss_nisplus/nisplus-pwd.c @@ -243,7 +243,7 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen, parse_res = _nss_nisplus_parse_pwent (&result, pw, buffer, buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) { *errnop = ERANGE; retval = NSS_STATUS_TRYAGAIN; @@ -317,7 +317,7 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); @@ -331,7 +331,7 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw, nis_freeresult (result); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) { @@ -376,7 +376,7 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); @@ -390,7 +390,7 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw, nis_freeresult (result); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) { diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c index 5604a5f850..0bcd0fb3c5 100644 --- a/nis/nss_nisplus/nisplus-rpc.c +++ b/nis/nss_nisplus/nisplus-rpc.c @@ -351,7 +351,7 @@ _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c index 805ccfb2fb..c32823b632 100644 --- a/nis/nss_nisplus/nisplus-service.c +++ b/nis/nss_nisplus/nisplus-service.c @@ -258,7 +258,7 @@ internal_nisplus_getservent_r (struct servent *serv, char *buffer, parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) { nis_freeresult (result); result = saved_res; @@ -360,7 +360,7 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); @@ -374,7 +374,7 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol, errnop); nis_freeresult (result); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) { @@ -429,7 +429,7 @@ _nss_nisplus_getservbyport_r (const int number, const char *protocol, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); @@ -443,7 +443,7 @@ _nss_nisplus_getservbyport_r (const int number, const char *protocol, errnop); nis_freeresult (result); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) { diff --git a/nis/nss_nisplus/nisplus-spwd.c b/nis/nss_nisplus/nisplus-spwd.c index 5b671e2681..f3c7f9df82 100644 --- a/nis/nss_nisplus/nisplus-spwd.c +++ b/nis/nss_nisplus/nisplus-spwd.c @@ -124,7 +124,7 @@ internal_nisplus_getspent_r (struct spwd *sp, char *buffer, size_t buflen, parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + if (__glibc_unlikely (parse_res == -1)) { nis_freeresult (result); result = saved_res; @@ -189,7 +189,7 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp, return NSS_STATUS_TRYAGAIN; } - if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + if (__glibc_unlikely (niserr2nss (result->status) != NSS_STATUS_SUCCESS)) { enum nss_status status = niserr2nss (result->status); @@ -202,7 +202,7 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp, parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen, errnop); nis_freeresult (result); - if (__builtin_expect (parse_res < 1, 0)) + if (__glibc_unlikely (parse_res < 1)) { if (parse_res == -1) { diff --git a/nis/ypclnt.c b/nis/ypclnt.c index 400db0a7ee..dd1833bbf6 100644 --- a/nis/ypclnt.c +++ b/nis/ypclnt.c @@ -183,7 +183,7 @@ __yp_bind (const char *domain, dom_binding **ypdb) { is_new = 1; ysd = (dom_binding *) calloc (1, sizeof *ysd); - if (__builtin_expect (ysd == NULL, 0)) + if (__glibc_unlikely (ysd == NULL)) return YPERR_RESRC; } @@ -471,7 +471,7 @@ yp_match (const char *indomain, const char *inmap, const char *inkey, *outvallen = resp.val.valdat_len; *outval = malloc (*outvallen + 1); int status = YPERR_RESRC; - if (__builtin_expect (*outval != NULL, 1)) + if (__glibc_likely (*outval != NULL)) { memcpy (*outval, resp.val.valdat_val, *outvallen); (*outval)[*outvallen] = '\0'; @@ -770,7 +770,7 @@ yp_all (const char *indomain, const char *inmap, (caddr_t) &req, (xdrproc_t) __xdr_ypresp_all, (caddr_t) &data, RPCTIMEOUT); - if (__builtin_expect (result != RPC_SUCCESS, 0)) + if (__glibc_unlikely (result != RPC_SUCCESS)) { /* Print the error message only on the last try. */ if (try == MAXTRIES - 1) @@ -811,7 +811,7 @@ yp_maplist (const char *indomain, struct ypmaplist **outmaplist) (caddr_t) &indomain, (xdrproc_t) xdr_ypresp_maplist, (caddr_t) &resp); - if (__builtin_expect (result == YPERR_SUCCESS, 1)) + if (__glibc_likely (result == YPERR_SUCCESS)) { *outmaplist = resp.maps; /* We don't free the list, this will be done by ypserv |