From a1ffb40e32741f992c743e7b16c061fefa3747ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20B=C3=ADlka?= Date: Mon, 10 Feb 2014 14:45:42 +0100 Subject: Use glibc_likely instead __builtin_expect. --- sysdeps/posix/clock_getres.c | 6 +++--- sysdeps/posix/fdopendir.c | 6 +++--- sysdeps/posix/getaddrinfo.c | 4 ++-- sysdeps/posix/opendir.c | 4 ++-- sysdeps/posix/sleep.c | 2 +- sysdeps/posix/tempname.c | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'sysdeps/posix') diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c index 27f264b..0bb1399 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 d8c6ec0..4071996 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 8218237..e1a399b 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 e366701..2740b3a 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 4a72c27..d8b1909 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 1f86549..d21c0cc 100644 --- a/sysdeps/posix/tempname.c +++ b/sysdeps/posix/tempname.c @@ -113,7 +113,7 @@ # include # 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 \ -- cgit v1.1