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 /locale | |
parent | 1448f3244714a9dabb5240ec18b094f100887d5c (diff) | |
download | glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.gz glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.xz glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.zip |
Use glibc_likely instead __builtin_expect.
Diffstat (limited to 'locale')
-rw-r--r-- | locale/findlocale.c | 4 | ||||
-rw-r--r-- | locale/loadarchive.c | 8 | ||||
-rw-r--r-- | locale/loadlocale.c | 10 | ||||
-rw-r--r-- | locale/setlocale.c | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/locale/findlocale.c b/locale/findlocale.c index 0c42b99251..bbaf708017 100644 --- a/locale/findlocale.c +++ b/locale/findlocale.c @@ -101,11 +101,11 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len, /* We really have to load some data. First we try the archive, but only if there was no LOCPATH environment variable specified. */ - if (__builtin_expect (locale_path == NULL, 1)) + if (__glibc_likely (locale_path == NULL)) { struct __locale_data *data = _nl_load_locale_from_archive (category, name); - if (__builtin_expect (data != NULL, 1)) + if (__glibc_likely (data != NULL)) return data; /* Nothing in the archive. Set the default path to search below. */ diff --git a/locale/loadarchive.c b/locale/loadarchive.c index e14535e7c0..22ac90d139 100644 --- a/locale/loadarchive.c +++ b/locale/loadarchive.c @@ -263,7 +263,7 @@ _nl_load_locale_from_archive (int category, const char **namep) } /* If there is no archive or it cannot be loaded for some reason fail. */ - if (__builtin_expect (headmap.ptr == NULL, 0)) + if (__glibc_unlikely (headmap.ptr == NULL)) goto close_and_out; /* We have the archive available. To find the name we first have to @@ -459,11 +459,11 @@ _nl_load_locale_from_archive (int category, const char **namep) Now we need the expected data structures to point into the data. */ lia = malloc (sizeof *lia); - if (__builtin_expect (lia == NULL, 0)) + if (__glibc_unlikely (lia == NULL)) return NULL; lia->name = strdup (*namep); - if (__builtin_expect (lia->name == NULL, 0)) + if (__glibc_unlikely (lia->name == NULL)) { free (lia); return NULL; @@ -478,7 +478,7 @@ _nl_load_locale_from_archive (int category, const char **namep) lia->data[cnt] = _nl_intern_locale_data (cnt, results[cnt].addr, results[cnt].len); - if (__builtin_expect (lia->data[cnt] != NULL, 1)) + if (__glibc_likely (lia->data[cnt] != NULL)) { /* _nl_intern_locale_data leaves us these fields to initialize. */ lia->data[cnt]->alloc = ld_archive; diff --git a/locale/loadlocale.c b/locale/loadlocale.c index f926036208..13eecea4e5 100644 --- a/locale/loadlocale.c +++ b/locale/loadlocale.c @@ -107,7 +107,7 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize) for (cnt = 0; cnt < newdata->nstrings; ++cnt) { size_t idx = filedata->strindex[cnt]; - if (__builtin_expect (idx > (size_t) newdata->filesize, 0)) + if (__glibc_unlikely (idx > (size_t) newdata->filesize)) { puntdata: free (newdata); @@ -183,7 +183,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) close_not_cancel_no_status (fd); return; } - if (__builtin_expect (S_ISDIR (st.st_mode), 0)) + if (__glibc_unlikely (S_ISDIR (st.st_mode))) { /* LOCALE/LC_foo is a directory; open LOCALE/LC_foo/SYS_LC_foo instead. */ @@ -221,7 +221,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) # endif filedata = __mmap ((caddr_t) 0, st.st_size, PROT_READ, MAP_FILE|MAP_COPY, fd, 0); - if (__builtin_expect (filedata == MAP_FAILED, 0)) + if (__glibc_unlikely (filedata == MAP_FAILED)) { filedata = NULL; if (__builtin_expect (errno, ENOSYS) == ENOSYS) @@ -258,12 +258,12 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) /* We have mapped the data, so we no longer need the descriptor. */ close_not_cancel_no_status (fd); - if (__builtin_expect (filedata == NULL, 0)) + if (__glibc_unlikely (filedata == NULL)) /* We failed to map or read the data. */ return; newdata = _nl_intern_locale_data (category, filedata, st.st_size); - if (__builtin_expect (newdata == NULL, 0)) + if (__glibc_unlikely (newdata == NULL)) /* Bad data. */ { #ifdef _POSIX_MAPPED_FILES diff --git a/locale/setlocale.c b/locale/setlocale.c index b70fa6cbce..94584683f7 100644 --- a/locale/setlocale.c +++ b/locale/setlocale.c @@ -278,7 +278,7 @@ setlocale (int category, const char *locale) if (category != LC_ALL) newnames[category] = (char *) locale; - if (__builtin_expect (strchr (locale, ';') != NULL, 0)) + if (__glibc_unlikely (strchr (locale, ';') != NULL)) { /* This is a composite name. Make a copy and split it up. */ char *np = strdupa (locale); |