From a1ffb40e32741f992c743e7b16c061fefa3747ac Mon Sep 17 00:00:00 2001 From: Ondřej Bílka Date: Mon, 10 Feb 2014 14:45:42 +0100 Subject: Use glibc_likely instead __builtin_expect. --- stdlib/cxa_finalize.c | 2 +- stdlib/cxa_thread_atexit_impl.c | 2 +- stdlib/drand48-iter.c | 2 +- stdlib/putenv.c | 2 +- stdlib/setenv.c | 6 +++--- stdlib/strtod_l.c | 12 ++++++------ stdlib/strtol_l.c | 8 ++++---- 7 files changed, 17 insertions(+), 17 deletions(-) (limited to 'stdlib') diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c index 299a9c0fc8..04f8e9a5d9 100644 --- a/stdlib/cxa_finalize.c +++ b/stdlib/cxa_finalize.c @@ -57,7 +57,7 @@ __cxa_finalize (void *d) /* It is possible that that last exit function registered more exit functions. Start the loop over. */ - if (__builtin_expect (check != __new_exitfn_called, 0)) + if (__glibc_unlikely (check != __new_exitfn_called)) goto restart; } } diff --git a/stdlib/cxa_thread_atexit_impl.c b/stdlib/cxa_thread_atexit_impl.c index d2f88d3ed8..1a6d9864f6 100644 --- a/stdlib/cxa_thread_atexit_impl.c +++ b/stdlib/cxa_thread_atexit_impl.c @@ -52,7 +52,7 @@ __cxa_thread_atexit_impl (dtor_func func, void *obj, void *dso_symbol) /* See if we already encountered the DSO. */ __rtld_lock_lock_recursive (GL(dl_load_lock)); - if (__builtin_expect (dso_symbol_cache != dso_symbol, 0)) + if (__glibc_unlikely (dso_symbol_cache != dso_symbol)) { ElfW(Addr) caller = (ElfW(Addr)) dso_symbol; diff --git a/stdlib/drand48-iter.c b/stdlib/drand48-iter.c index 10d2969df0..82e58873a4 100644 --- a/stdlib/drand48-iter.c +++ b/stdlib/drand48-iter.c @@ -35,7 +35,7 @@ __drand48_iterate (xsubi, buffer) uint64_t result; /* Initialize buffer, if not yet done. */ - if (__builtin_expect (!buffer->__init, 0)) + if (__glibc_unlikely (!buffer->__init)) { buffer->__a = 0x5deece66dull; buffer->__c = 0xb; diff --git a/stdlib/putenv.c b/stdlib/putenv.c index 9bc16872b4..e6ad267afe 100644 --- a/stdlib/putenv.c +++ b/stdlib/putenv.c @@ -77,7 +77,7 @@ putenv (string) #endif int result = __add_to_environ (name, NULL, string, 1); - if (__builtin_expect (use_malloc, 0)) + if (__glibc_unlikely (use_malloc)) free (name); return result; diff --git a/stdlib/setenv.c b/stdlib/setenv.c index 6b5f9be8d5..e244e18331 100644 --- a/stdlib/setenv.c +++ b/stdlib/setenv.c @@ -191,17 +191,17 @@ __add_to_environ (name, value, combined, replace) # endif np = KNOWN_VALUE (new_value); - if (__builtin_expect (np == NULL, 1)) + if (__glibc_likely (np == NULL)) #endif { #ifdef USE_TSEARCH - if (__builtin_expect (! use_alloca, 0)) + if (__glibc_unlikely (! use_alloca)) np = new_value; else #endif { np = malloc (varlen); - if (__builtin_expect (np == NULL, 0)) + if (__glibc_unlikely (np == NULL)) { UNLOCK; return -1; diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index c80306deef..6707e482a4 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -545,7 +545,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) struct __locale_data *current = loc->__locales[LC_NUMERIC]; - if (__builtin_expect (group, 0)) + if (__glibc_unlikely (group)) { grouping = _NL_CURRENT (LC_NUMERIC, GROUPING); if (*grouping <= 0 || *grouping == CHAR_MAX) @@ -709,7 +709,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) while (c == L'0' || ((wint_t) thousands != L'\0' && c == (wint_t) thousands)) c = *++cp; #else - if (__builtin_expect (thousands == NULL, 1)) + if (__glibc_likely (thousands == NULL)) while (c == '0') c = *++cp; else @@ -789,7 +789,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) /* Not a digit or separator: end of the integer part. */ break; #else - if (__builtin_expect (thousands == NULL, 1)) + if (__glibc_likely (thousands == NULL)) break; else { @@ -1181,10 +1181,10 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) exponent -= incr; } - if (__builtin_expect (exponent > MAX_10_EXP + 1 - (intmax_t) int_no, 0)) + if (__glibc_unlikely (exponent > MAX_10_EXP + 1 - (intmax_t) int_no)) return overflow_value (negative); - if (__builtin_expect (exponent < MIN_10_EXP - (DIG + 1), 0)) + if (__glibc_unlikely (exponent < MIN_10_EXP - (DIG + 1))) return underflow_value (negative); if (int_no > 0) @@ -1245,7 +1245,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) /* Now we know the exponent of the number in base two. Check it against the maximum possible exponent. */ - if (__builtin_expect (bits > MAX_EXP, 0)) + if (__glibc_unlikely (bits > MAX_EXP)) return overflow_value (negative); /* We have already the first BITS bits of the result. Together with diff --git a/stdlib/strtol_l.c b/stdlib/strtol_l.c index 95c2df398a..c77b43dc0c 100644 --- a/stdlib/strtol_l.c +++ b/stdlib/strtol_l.c @@ -255,7 +255,7 @@ INTERNAL (__strtol_l) (nptr, endptr, base, group, loc) in the format described in . */ const char *grouping; - if (__builtin_expect (group, 0)) + if (__glibc_unlikely (group)) { grouping = _NL_CURRENT (LC_NUMERIC, GROUPING); if (*grouping <= 0 || *grouping == CHAR_MAX) @@ -297,7 +297,7 @@ INTERNAL (__strtol_l) (nptr, endptr, base, group, loc) /* Skip white space. */ while (ISSPACE (*s)) ++s; - if (__builtin_expect (*s == L_('\0'), 0)) + if (__glibc_unlikely (*s == L_('\0'))) goto noconv; /* Check for a sign. */ @@ -331,7 +331,7 @@ INTERNAL (__strtol_l) (nptr, endptr, base, group, loc) if (base != 10) grouping = NULL; - if (__builtin_expect (grouping != NULL, 0)) + if (__glibc_unlikely (grouping != NULL)) { # ifndef USE_WIDE_CHAR thousands_len = strlen (thousands); @@ -499,7 +499,7 @@ INTERNAL (__strtol_l) (nptr, endptr, base, group, loc) overflow = 1; #endif - if (__builtin_expect (overflow, 0)) + if (__glibc_unlikely (overflow)) { __set_errno (ERANGE); #if UNSIGNED -- cgit 1.4.1