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.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, |
