summaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authorOndřej Bílka <neleai@seznam.cz>2014-02-10 14:45:42 +0100
committerOndřej Bílka <neleai@seznam.cz>2014-02-10 15:07:12 +0100
commita1ffb40e32741f992c743e7b16c061fefa3747ac (patch)
tree246a29a87b26cfd5d07b17070f85eb3785018de9 /libio
parent1448f3244714a9dabb5240ec18b094f100887d5c (diff)
downloadglibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.gz
Use glibc_likely instead __builtin_expect.
Diffstat (limited to 'libio')
-rw-r--r--libio/filedoalloc.c2
-rw-r--r--libio/fileops.c10
-rw-r--r--libio/fmemopen.c4
-rw-r--r--libio/iofgets.c2
-rw-r--r--libio/iofgets_u.c2
-rw-r--r--libio/iofgetws.c2
-rw-r--r--libio/iofgetws_u.c2
-rw-r--r--libio/iogetdelim.c2
-rw-r--r--libio/wfileops.c12
9 files changed, 19 insertions, 19 deletions
diff --git a/libio/filedoalloc.c b/libio/filedoalloc.c
index 3b66ec6bb6..79005773f9 100644
--- a/libio/filedoalloc.c
+++ b/libio/filedoalloc.c
@@ -103,7 +103,7 @@ _IO_file_doallocate (fp)
function it points to. This is to make sure _IO_cleanup gets called
on exit. We call it from _IO_file_doallocate, since that is likely
to get called by any program that does buffered I/O. */
- if (__builtin_expect (_IO_cleanup_registration_needed != NULL, 0))
+ if (__glibc_unlikely (_IO_cleanup_registration_needed != NULL))
(*_IO_cleanup_registration_needed) ();
#endif
diff --git a/libio/fileops.c b/libio/fileops.c
index 36bea49992..a3499be460 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -220,7 +220,7 @@ _IO_file_open (fp, filename, posix_mode, prot, read_write, is32not64)
{
int fdesc;
#ifdef _LIBC
- if (__builtin_expect (fp->_flags2 & _IO_FLAGS2_NOTCANCEL, 0))
+ if (__glibc_unlikely (fp->_flags2 & _IO_FLAGS2_NOTCANCEL))
fdesc = open_not_cancel (filename,
posix_mode | (is32not64 ? 0 : O_LARGEFILE), prot);
else
@@ -726,7 +726,7 @@ _IO_file_underflow_mmap (_IO_FILE *fp)
if (fp->_IO_read_ptr < fp->_IO_read_end)
return *(unsigned char *) fp->_IO_read_ptr;
- if (__builtin_expect (mmap_remap_check (fp), 0))
+ if (__glibc_unlikely (mmap_remap_check (fp)))
/* We punted to the regular file functions. */
return _IO_UNDERFLOW (fp);
@@ -836,7 +836,7 @@ _IO_new_file_overflow (f, ch)
makes room for subsequent output.
Otherwise, set the read pointers to _IO_read_end (leaving that
alone, so it can continue to correspond to the external position). */
- if (__builtin_expect (_IO_in_backup (f), 0))
+ if (__glibc_unlikely (_IO_in_backup (f)))
{
size_t nbackup = f->_IO_read_end - f->_IO_read_ptr;
_IO_free_backup_area (f);
@@ -1464,7 +1464,7 @@ _IO_file_xsgetn_mmap (fp, data, n)
if (have < n)
{
- if (__builtin_expect (_IO_in_backup (fp), 0))
+ if (__glibc_unlikely (_IO_in_backup (fp)))
{
#ifdef _LIBC
s = __mempcpy (s, read_ptr, have);
@@ -1481,7 +1481,7 @@ _IO_file_xsgetn_mmap (fp, data, n)
if (have < n)
{
/* Check that we are mapping all of the file, in case it grew. */
- if (__builtin_expect (mmap_remap_check (fp), 0))
+ if (__glibc_unlikely (mmap_remap_check (fp)))
/* We punted mmap, so complete with the vanilla code. */
return s - (char *) data + _IO_XSGETN (fp, data, n);
diff --git a/libio/fmemopen.c b/libio/fmemopen.c
index e370a8b9e7..aee26963a3 100644
--- a/libio/fmemopen.c
+++ b/libio/fmemopen.c
@@ -202,7 +202,7 @@ fmemopen (void *buf, size_t len, const char *mode)
cookie_io_functions_t iof;
fmemopen_cookie_t *c;
- if (__builtin_expect (len == 0, 0))
+ if (__glibc_unlikely (len == 0))
{
einval:
__set_errno (EINVAL);
@@ -228,7 +228,7 @@ fmemopen (void *buf, size_t len, const char *mode)
}
else
{
- if (__builtin_expect ((uintptr_t) len > -(uintptr_t) buf, 0))
+ if (__glibc_unlikely ((uintptr_t) len > -(uintptr_t) buf))
{
free (c);
goto einval;
diff --git a/libio/iofgets.c b/libio/iofgets.c
index bf7f84ad3e..1b708cad0d 100644
--- a/libio/iofgets.c
+++ b/libio/iofgets.c
@@ -39,7 +39,7 @@ _IO_fgets (buf, n, fp)
CHECK_FILE (fp, NULL);
if (n <= 0)
return NULL;
- if (__builtin_expect (n == 1, 0))
+ if (__glibc_unlikely (n == 1))
{
/* Another irregular case: since we have to store a NUL byte and
there is only room for exactly one byte, we don't have to
diff --git a/libio/iofgets_u.c b/libio/iofgets_u.c
index 128327e49b..b2d4d8fe2b 100644
--- a/libio/iofgets_u.c
+++ b/libio/iofgets_u.c
@@ -39,7 +39,7 @@ fgets_unlocked (buf, n, fp)
CHECK_FILE (fp, NULL);
if (n <= 0)
return NULL;
- if (__builtin_expect (n == 1, 0))
+ if (__glibc_unlikely (n == 1))
{
/* Another irregular case: since we have to store a NUL byte and
there is only room for exactly one byte, we don't have to
diff --git a/libio/iofgetws.c b/libio/iofgetws.c
index 193c1a9946..fcbdda8765 100644
--- a/libio/iofgetws.c
+++ b/libio/iofgetws.c
@@ -39,7 +39,7 @@ fgetws (buf, n, fp)
CHECK_FILE (fp, NULL);
if (n <= 0)
return NULL;
- if (__builtin_expect (n == 1, 0))
+ if (__glibc_unlikely (n == 1))
{
/* Another irregular case: since we have to store a NUL byte and
there is only room for exactly one byte, we don't have to
diff --git a/libio/iofgetws_u.c b/libio/iofgetws_u.c
index 14c4898ea2..1126d7bd3b 100644
--- a/libio/iofgetws_u.c
+++ b/libio/iofgetws_u.c
@@ -39,7 +39,7 @@ fgetws_unlocked (buf, n, fp)
CHECK_FILE (fp, NULL);
if (n <= 0)
return NULL;
- if (__builtin_expect (n == 1, 0))
+ if (__glibc_unlikely (n == 1))
{
/* Another irregular case: since we have to store a NUL byte and
there is only room for exactly one byte, we don't have to
diff --git a/libio/iogetdelim.c b/libio/iogetdelim.c
index e2e0b0775e..a817050d8f 100644
--- a/libio/iogetdelim.c
+++ b/libio/iogetdelim.c
@@ -89,7 +89,7 @@ _IO_getdelim (lineptr, n, delimiter, fp)
t = (char *) memchr ((void *) fp->_IO_read_ptr, delimiter, len);
if (t != NULL)
len = (t - fp->_IO_read_ptr) + 1;
- if (__builtin_expect (len >= SSIZE_MAX - cur_len, 0))
+ if (__glibc_unlikely (len >= SSIZE_MAX - cur_len))
{
__set_errno (EOVERFLOW);
result = -1;
diff --git a/libio/wfileops.c b/libio/wfileops.c
index 877fc1f829..9cebe77126 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -123,7 +123,7 @@ _IO_wfile_underflow (fp)
enum __codecvt_result status;
_IO_ssize_t count;
- if (__builtin_expect (fp->_flags & _IO_NO_READS, 0))
+ if (__glibc_unlikely (fp->_flags & _IO_NO_READS))
{
fp->_flags |= _IO_ERR_SEEN;
__set_errno (EBADF);
@@ -264,7 +264,7 @@ _IO_wfile_underflow (fp)
const char *from = fp->_IO_read_ptr;
const char *to = fp->_IO_read_end;
size_t to_copy = count;
- if (__builtin_expect (naccbuf != 0, 0))
+ if (__glibc_unlikely (naccbuf != 0))
{
to_copy = MIN (sizeof (accbuf) - naccbuf, count);
to = __mempcpy (&accbuf[naccbuf], from, to_copy);
@@ -277,7 +277,7 @@ _IO_wfile_underflow (fp)
fp->_wide_data->_IO_buf_end,
&fp->_wide_data->_IO_read_end);
- if (__builtin_expect (naccbuf != 0, 0))
+ if (__glibc_unlikely (naccbuf != 0))
fp->_IO_read_ptr += MAX (0, read_ptr_copy - &accbuf[naccbuf - to_copy]);
else
fp->_IO_read_ptr = (char *) read_ptr_copy;
@@ -341,7 +341,7 @@ _IO_wfile_underflow_mmap (_IO_FILE *fp)
struct _IO_codecvt *cd;
const char *read_stop;
- if (__builtin_expect (fp->_flags & _IO_NO_READS, 0))
+ if (__glibc_unlikely (fp->_flags & _IO_NO_READS))
{
fp->_flags |= _IO_ERR_SEEN;
__set_errno (EBADF);
@@ -581,7 +581,7 @@ adjust_wide_data (_IO_FILE *fp, bool do_convert)
&fp->_wide_data->_IO_read_end);
/* Should we return EILSEQ? */
- if (__builtin_expect (status == __codecvt_error, 0))
+ if (__glibc_unlikely (status == __codecvt_error))
{
fp->_flags |= _IO_ERR_SEEN;
return -1;
@@ -755,7 +755,7 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
/* If there was an error, then return WEOF.
TODO: set buffer state. */
- if (__builtin_expect (status == __codecvt_error, 0))
+ if (__glibc_unlikely (status == __codecvt_error))
return WEOF;
}
while (delta > 0);