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 /sysdeps/posix | |
parent | 1448f3244714a9dabb5240ec18b094f100887d5c (diff) | |
download | glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.gz glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.xz glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.zip |
Use glibc_likely instead __builtin_expect.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r-- | sysdeps/posix/clock_getres.c | 6 | ||||
-rw-r--r-- | sysdeps/posix/fdopendir.c | 6 | ||||
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 4 | ||||
-rw-r--r-- | sysdeps/posix/opendir.c | 4 | ||||
-rw-r--r-- | sysdeps/posix/sleep.c | 2 | ||||
-rw-r--r-- | sysdeps/posix/tempname.c | 2 |
6 files changed, 12 insertions, 12 deletions
diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c index 27f264bb16..0bb1399e97 100644 --- a/sysdeps/posix/clock_getres.c +++ b/sysdeps/posix/clock_getres.c @@ -30,7 +30,7 @@ static long int nsec; /* Clock frequency of the processor. */ static int hp_timing_getres (struct timespec *res) { - if (__builtin_expect (nsec == 0, 0)) + if (__glibc_unlikely (nsec == 0)) { hp_timing_t freq; @@ -39,7 +39,7 @@ hp_timing_getres (struct timespec *res) code against multiple execution since all of them should lead to the same result. */ freq = __get_clockfreq (); - if (__builtin_expect (freq == 0, 0)) + if (__glibc_unlikely (freq == 0)) /* Something went wrong. */ return -1; @@ -60,7 +60,7 @@ realtime_getres (struct timespec *res) { long int clk_tck = sysconf (_SC_CLK_TCK); - if (__builtin_expect (clk_tck != -1, 1)) + if (__glibc_likely (clk_tck != -1)) { /* This implementation assumes that the realtime clock has a resolution higher than 1 second. This is the case for any diff --git a/sysdeps/posix/fdopendir.c b/sysdeps/posix/fdopendir.c index d8c6ec0513..4071996dcd 100644 --- a/sysdeps/posix/fdopendir.c +++ b/sysdeps/posix/fdopendir.c @@ -31,7 +31,7 @@ __fdopendir (int fd) if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0) return NULL; - if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0)) + if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode))) { __set_errno (ENOTDIR); return NULL; @@ -39,9 +39,9 @@ __fdopendir (int fd) /* Make sure the descriptor allows for reading. */ int flags = __fcntl (fd, F_GETFL); - if (__builtin_expect (flags == -1, 0)) + if (__glibc_unlikely (flags == -1)) return NULL; - if (__builtin_expect ((flags & O_ACCMODE) == O_WRONLY, 0)) + if (__glibc_unlikely ((flags & O_ACCMODE) == O_WRONLY)) { __set_errno (EINVAL); return NULL; diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 8218237af2..e1a399b3ca 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -471,7 +471,7 @@ gaih_inet (const char *name, const struct gaih_service *service, bool malloc_namebuf = false; char *namebuf = (char *) name; - if (__builtin_expect (scope_delim != NULL, 0)) + if (__glibc_unlikely (scope_delim != NULL)) { if (malloc_name) *scope_delim = '\0'; @@ -2608,7 +2608,7 @@ getaddrinfo (const char *name, const char *service, the information. */ struct sort_result_combo src = { .results = results, .nresults = nresults }; - if (__builtin_expect (gaiconf_reload_flag_ever_set, 0)) + if (__glibc_unlikely (gaiconf_reload_flag_ever_set)) { __libc_lock_define_initialized (static, lock); diff --git a/sysdeps/posix/opendir.c b/sysdeps/posix/opendir.c index e366701bd4..2740b3ac29 100644 --- a/sysdeps/posix/opendir.c +++ b/sysdeps/posix/opendir.c @@ -110,7 +110,7 @@ __opendirat (int dfd, const char *name) performed on, say, a tape device might have undesirable effects. */ if (__builtin_expect (__xstat64 (_STAT_VER, name, &statbuf), 0) < 0) return NULL; - if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0)) + if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode))) { __set_errno (ENOTDIR); return NULL; @@ -139,7 +139,7 @@ __opendirat (int dfd, const char *name) the `stat' call. */ if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0) goto lose; - if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0)) + if (__glibc_unlikely (! S_ISDIR (statbuf.st_mode))) { __set_errno (ENOTDIR); lose: diff --git a/sysdeps/posix/sleep.c b/sysdeps/posix/sleep.c index 4a72c275b3..d8b19099fd 100644 --- a/sysdeps/posix/sleep.c +++ b/sysdeps/posix/sleep.c @@ -33,7 +33,7 @@ unsigned int __sleep (unsigned int seconds) { /* This is not necessary but some buggy programs depend on it. */ - if (__builtin_expect (seconds == 0, 0)) + if (__glibc_unlikely (seconds == 0)) { #ifdef CANCELLATION_P CANCELLATION_P (THREAD_SELF); diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c index 1f86549df3..d21c0ccf00 100644 --- a/sysdeps/posix/tempname.c +++ b/sysdeps/posix/tempname.c @@ -113,7 +113,7 @@ # include <hp-timing.h> # if HP_TIMING_AVAIL # define RANDOM_BITS(Var) \ - if (__builtin_expect (value == UINT64_C (0), 0)) \ + if (__glibc_unlikely (value == UINT64_C (0))) \ { \ /* If this is the first time this function is used initialize \ the variable we accumulate the value in to some somewhat \ |