aboutsummaryrefslogtreecommitdiff
path: root/locale/findlocale.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-07 16:35:57 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-07 16:35:57 +0000
commit3a31f6f4092d33132669bde62141b0000d06fc68 (patch)
tree59156e88adc41e51b688d0c2788ca5e530bd8eb8 /locale/findlocale.c
parentd5bc737a32bc409066a717cf517bfebe3daa6013 (diff)
downloadglibc-3a31f6f4092d33132669bde62141b0000d06fc68.tar
glibc-3a31f6f4092d33132669bde62141b0000d06fc68.tar.gz
glibc-3a31f6f4092d33132669bde62141b0000d06fc68.tar.bz2
glibc-3a31f6f4092d33132669bde62141b0000d06fc68.zip
Add __builtin_expect in many places.
Diffstat (limited to 'locale/findlocale.c')
-rw-r--r--locale/findlocale.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/locale/findlocale.c b/locale/findlocale.c
index 60d318b378..f0c911d29f 100644
--- a/locale/findlocale.c
+++ b/locale/findlocale.c
@@ -57,7 +57,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
if ((*name)[0] == '\0'
/* In SUID binaries we must not allow people to access files
outside the dedicated locale directories. */
- || (__libc_enable_secure
+ || (__builtin_expect (__libc_enable_secure, 0)
&& memchr (*name, '/', _nl_find_language (*name) - *name) != NULL))
{
/* The user decides which locale to use by setting environment
@@ -71,7 +71,8 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
*name = (char *) _nl_C_name;
}
- if (strcmp (*name, _nl_C_name) == 0 || strcmp (*name, _nl_POSIX_name) == 0)
+ if (__builtin_expect (strcmp (*name, _nl_C_name), 1) == 0
+ || __builtin_expect (strcmp (*name, _nl_POSIX_name), 1) == 0)
{
/* We need not load anything. The needed data is contained in
the library itself. */
@@ -159,10 +160,10 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
successors. */
locale_file->successor[0] = locale_file->successor[cnt];
locale_file = locale_file->successor[cnt];
- }
- if (locale_file == NULL)
- return NULL;
+ if (locale_file == NULL)
+ return NULL;
+ }
/* Determine the locale name for which loading succeeded. This
information comes from the file name. The form is
@@ -214,7 +215,7 @@ _nl_remove_locale (int locale, struct locale_data *data)
#ifdef _POSIX_MAPPED_FILES
/* Really delete the data. First delete the real data. */
- if (data->mmaped)
+ if (__builtin_expect (data->mmaped, 1))
{
/* Try to unmap the area. If this fails we mark the area as
permanent. */