diff options
author | Ulrich Drepper <drepper@redhat.com> | 2007-10-15 04:22:46 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2007-10-15 04:22:46 +0000 |
commit | 1b6aa63f4e5e8f271f4bb8269edb18842d5941e6 (patch) | |
tree | 610e4baa791b02b2dbb70c70e49dad54590be49f | |
parent | 895a08c0897a753a30250bb4995b5cf771ee0084 (diff) | |
download | glibc-1b6aa63f4e5e8f271f4bb8269edb18842d5941e6.tar.gz |
* posix/glob.c: Add some branch prediction throughout.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | posix/glob.c | 18 |
2 files changed, 11 insertions, 9 deletions
@@ -1,5 +1,7 @@ 2007-10-14 Ulrich Drepper <drepper@redhat.com> + * posix/glob.c: Add some branch prediction throughout. + * nscd/nscd_getgr_r.c (nscd_getgr_r): Store result of successful read from nscd. diff --git a/posix/glob.c b/posix/glob.c index d6a1a4a2d1..38110fd135 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -774,7 +774,7 @@ glob (pattern, flags, errfunc, pglob) /* Return the directory if we don't check for error or if it exists. */ if ((flags & GLOB_NOCHECK) - || (((flags & GLOB_ALTDIRFUNC) + || (((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)) ? ((*pglob->gl_stat) (dirname, &st) == 0 && S_ISDIR (st.st_mode)) : (__stat64 (dirname, &st64) == 0 && S_ISDIR (st64.st_mode))))) @@ -846,7 +846,7 @@ glob (pattern, flags, errfunc, pglob) *(char *) &dirname[--dirlen] = '\0'; } - if ((flags & GLOB_ALTDIRFUNC) != 0) + if (__builtin_expect ((flags & GLOB_ALTDIRFUNC) != 0, 0)) { /* Use the alternative access functions also in the recursive call. */ @@ -1030,7 +1030,7 @@ glob (pattern, flags, errfunc, pglob) struct_stat64 st64; for (i = oldcount; i < pglob->gl_pathc + pglob->gl_offs; ++i) - if (((flags & GLOB_ALTDIRFUNC) + if ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) ? ((*pglob->gl_stat) (pglob->gl_pathv[i], &st) == 0 && S_ISDIR (st.st_mode)) : (__stat64 (pglob->gl_pathv[i], &st64) == 0 @@ -1233,7 +1233,7 @@ link_exists_p (const char *dir, size_t dirlen, const char *fname, mempcpy (mempcpy (mempcpy (fullname, dir, dirlen), "/", 1), fname, fnamelen + 1); - return (((flags & GLOB_ALTDIRFUNC) + return ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) ? (*pglob->gl_stat) (fullname, &st) : __stat64 (fullname, &st64)) == 0); } @@ -1290,7 +1290,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, mempcpy (mempcpy (mempcpy (fullname, directory, dirlen), "/", 1), pattern, patlen + 1); - if (((flags & GLOB_ALTDIRFUNC) + if ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) ? (*pglob->gl_stat) (fullname, &st) : __stat64 (fullname, &st64)) == 0) /* We found this file to be existing. Now tell the rest @@ -1299,7 +1299,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, } else { - stream = ((flags & GLOB_ALTDIRFUNC) + stream = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) ? (*pglob->gl_opendir) (directory) : opendir (directory)); if (stream == NULL) @@ -1333,7 +1333,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, } d64buf; - if (flags & GLOB_ALTDIRFUNC) + if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)) { struct dirent *d32 = (*pglob->gl_readdir) (stream); if (d32 != NULL) @@ -1347,7 +1347,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, else d = __readdir64 (stream); #else - struct dirent *d = ((flags & GLOB_ALTDIRFUNC) + struct dirent *d = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) ? ((struct dirent *) (*pglob->gl_readdir) (stream)) : __readdir (stream)); @@ -1485,7 +1485,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, if (stream != NULL) { save = errno; - if (flags & GLOB_ALTDIRFUNC) + if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)) (*pglob->gl_closedir) (stream); else closedir (stream); |