about summary refs log tree commit diff
path: root/nis/nss_nis
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_nis')
-rw-r--r--nis/nss_nis/nis-alias.c16
-rw-r--r--nis/nss_nis/nis-ethers.c16
-rw-r--r--nis/nss_nis/nis-grp.c24
-rw-r--r--nis/nss_nis/nis-hosts.c34
-rw-r--r--nis/nss_nis/nis-initgroups.c8
-rw-r--r--nis/nss_nis/nis-netgrp.c6
-rw-r--r--nis/nss_nis/nis-network.c24
-rw-r--r--nis/nss_nis/nis-proto.c16
-rw-r--r--nis/nss_nis/nis-publickey.c4
-rw-r--r--nis/nss_nis/nis-pwd.c30
-rw-r--r--nis/nss_nis/nis-rpc.c18
-rw-r--r--nis/nss_nis/nis-service.c30
-rw-r--r--nis/nss_nis/nis-spwd.c12
13 files changed, 119 insertions, 119 deletions
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;