about summary refs log tree commit diff
path: root/dirent/scandir.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-04-21 16:15:11 +0000
committerUlrich Drepper <drepper@redhat.com>2000-04-21 16:15:11 +0000
commita711dd4ba8f2c71a260a3f7539c0e86175f97a21 (patch)
tree1bf9e3eb9a49f3b9cdcd0dee9515339486170f74 /dirent/scandir.c
parent761df3a7aa6eb65aa66c78e6c1da627e453de458 (diff)
downloadglibc-a711dd4ba8f2c71a260a3f7539c0e86175f97a21.tar.gz
glibc-a711dd4ba8f2c71a260a3f7539c0e86175f97a21.tar.xz
glibc-a711dd4ba8f2c71a260a3f7539c0e86175f97a21.zip
Update.
2000-04-21  Ulrich Drepper  <drepper@redhat.com>

	* iconv/iconv.c (iconv): Add __builtin_expect where useful.
	* iconv/iconv_close.c (iconv_close): Likewise.
	* iconv/iconv_open.c (iconv_open): Likewise.

	* grp/putgrent.c (putgrent): Unlock steam if fprintf failed.  Add
	__builtin_expect where useful.

	* grp/initgroups.c (initgroups): Test for result of memory
	allocation and punt if it fails.

	* dirent/scandir.c (scandir): Add __builtin_expect where useful.
	* grp/fgetgrent.c (fgetfrent): Likewise.
	* grp/fgetgrent_r.c (__fgetgrent_r): Likewise.
Diffstat (limited to 'dirent/scandir.c')
-rw-r--r--dirent/scandir.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/dirent/scandir.c b/dirent/scandir.c
index ed9071df6e..9b4548cd16 100644
--- a/dirent/scandir.c
+++ b/dirent/scandir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,8 +25,8 @@ int
 scandir (dir, namelist, select, cmp)
      const char *dir;
      struct dirent ***namelist;
-     int (*select) __P ((const struct dirent *));
-     int (*cmp) __P ((const void *, const void *));
+     int (*select) (const struct dirent *);
+     int (*cmp) (const void *, const void *);
 {
   DIR *dp = __opendir (dir);
   struct dirent **v = NULL;
@@ -50,7 +50,7 @@ scandir (dir, namelist, select, cmp)
 	/* Ignore errors from select or readdir */
 	__set_errno (0);
 
-	if (i == vsize)
+	if (__builtin_expect (i == vsize, 0))
 	  {
 	    struct dirent **new;
 	    if (vsize == 0)
@@ -71,7 +71,7 @@ scandir (dir, namelist, select, cmp)
 	v[i++] = (struct dirent *) memcpy (vnew, d, dsize);
       }
 
-  if (errno != 0)
+  if (__builtin_expect (errno, 0) != 0)
     {
       save = errno;
       (void) __closedir (dp);