]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - nis/nss_nis/nis-pwd.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / nis / nss_nis / nis-pwd.c
index 89de350c4dab47d48d073a5a1f3d2231af9c9973..6a759eeaec1fc99d1b47db3e14bffc55b21409e8 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (C) 1996-1998,2001-2003,2006,2009,2010
-   Free Software Foundation, Inc.
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -14,9 +13,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <assert.h>
 #include <ctype.h>
@@ -24,7 +22,7 @@
 #include <nss.h>
 #include <pwd.h>
 #include <string.h>
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 
@@ -59,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));
@@ -94,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;
@@ -145,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;
@@ -212,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;
@@ -251,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);
 
@@ -314,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;
@@ -332,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);
@@ -381,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);
@@ -390,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);
 
@@ -449,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;
@@ -466,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;
@@ -482,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];
@@ -492,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);
 
@@ -554,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;
@@ -571,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;