summaryrefslogtreecommitdiff
path: root/iconv
diff options
context:
space:
mode:
Diffstat (limited to 'iconv')
-rw-r--r--iconv/gconv_cache.c2
-rw-r--r--iconv/gconv_close.c2
-rw-r--r--iconv/gconv_open.c4
-rw-r--r--iconv/gconv_simple.c58
-rw-r--r--iconv/iconv.c2
-rw-r--r--iconv/iconv_close.c2
-rw-r--r--iconv/loop.c4
-rw-r--r--iconv/skeleton.c18
8 files changed, 46 insertions, 46 deletions
diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c
index 41a4688f2a..f3a4337812 100644
--- a/iconv/gconv_cache.c
+++ b/iconv/gconv_cache.c
@@ -79,7 +79,7 @@ __gconv_load_cache (void)
cache_size = st.st_size;
#ifdef _POSIX_MAPPED_FILES
gconv_cache = __mmap (NULL, cache_size, PROT_READ, MAP_SHARED, fd, 0);
- if (__builtin_expect (gconv_cache == MAP_FAILED, 0))
+ if (__glibc_unlikely (gconv_cache == MAP_FAILED))
#endif
{
size_t already_read;
diff --git a/iconv/gconv_close.c b/iconv/gconv_close.c
index 9d01f146cc..81f0e0b319 100644
--- a/iconv/gconv_close.c
+++ b/iconv/gconv_close.c
@@ -45,7 +45,7 @@ __gconv_close (__gconv_t cd)
struct __gconv_trans_data *curp = transp;
transp = transp->__next;
- if (__builtin_expect (curp->__trans_end_fct != NULL, 0))
+ if (__glibc_unlikely (curp->__trans_end_fct != NULL))
curp->__trans_end_fct (curp->__data);
free (curp);
diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c
index 69a1f65eb2..bfbe22bff6 100644
--- a/iconv/gconv_open.c
+++ b/iconv/gconv_open.c
@@ -45,7 +45,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
errhand = strchr (toset, '/');
if (errhand != NULL)
errhand = strchr (errhand + 1, '/');
- if (__builtin_expect (errhand != NULL, 1))
+ if (__glibc_likely (errhand != NULL))
{
if (*++errhand == '\0')
errhand = NULL;
@@ -318,7 +318,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
struct __gconv_trans_data *curp = transp;
transp = transp->__next;
- if (__builtin_expect (curp->__trans_end_fct != NULL, 0))
+ if (__glibc_unlikely (curp->__trans_end_fct != NULL))
curp->__trans_end_fct (curp->__data);
free (curp);
diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
index 27acb5e892..e11e2eea2d 100644
--- a/iconv/gconv_simple.c
+++ b/iconv/gconv_simple.c
@@ -177,7 +177,7 @@ internal_ucs4_loop_single (struct __gconv_step *step,
while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (__builtin_expect (cnt < 4, 0))
+ if (__glibc_unlikely (cnt < 4))
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
@@ -249,7 +249,7 @@ ucs4_internal_loop (struct __gconv_step *step,
inval = *(const uint32_t *) inptr;
#endif
- if (__builtin_expect (inval > 0x7fffffff, 0))
+ if (__glibc_unlikely (inval > 0x7fffffff))
{
/* The value is too large. We don't try transliteration here since
this is not an error because of the lack of possibilities to
@@ -308,7 +308,7 @@ ucs4_internal_loop_unaligned (struct __gconv_step *step,
for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
{
- if (__builtin_expect (inptr[0] > 0x80, 0))
+ if (__glibc_unlikely (inptr[0] > 0x80))
{
/* The value is too large. We don't try transliteration here since
this is not an error because of the lack of possibilities to
@@ -376,7 +376,7 @@ ucs4_internal_loop_single (struct __gconv_step *step,
while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (__builtin_expect (cnt < 4, 0))
+ if (__glibc_unlikely (cnt < 4))
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
@@ -546,7 +546,7 @@ internal_ucs4le_loop_single (struct __gconv_step *step,
while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (__builtin_expect (cnt < 4, 0))
+ if (__glibc_unlikely (cnt < 4))
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
@@ -617,7 +617,7 @@ ucs4le_internal_loop (struct __gconv_step *step,
inval = *(const uint32_t *) inptr;
#endif
- if (__builtin_expect (inval > 0x7fffffff, 0))
+ if (__glibc_unlikely (inval > 0x7fffffff))
{
/* The value is too large. We don't try transliteration here since
this is not an error because of the lack of possibilities to
@@ -677,7 +677,7 @@ ucs4le_internal_loop_unaligned (struct __gconv_step *step,
for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
{
- if (__builtin_expect (inptr[3] > 0x80, 0))
+ if (__glibc_unlikely (inptr[3] > 0x80))
{
/* The value is too large. We don't try transliteration here since
this is not an error because of the lack of possibilities to
@@ -749,7 +749,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
while (*inptrp < inend && cnt < 4)
state->__value.__wchb[cnt++] = *(*inptrp)++;
- if (__builtin_expect (cnt < 4, 0))
+ if (__glibc_unlikely (cnt < 4))
{
/* Still not enough bytes. Store the ones in the input buffer. */
state->__count &= ~7;
@@ -810,7 +810,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
#define LOOPFCT FROM_LOOP
#define BODY \
{ \
- if (__builtin_expect (*inptr > '\x7f', 0)) \
+ if (__glibc_unlikely (*inptr > '\x7f')) \
{ \
/* The value is too large. We don't try transliteration here since \
this is not an error because of the lack of possibilities to \
@@ -846,7 +846,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
#define LOOPFCT FROM_LOOP
#define BODY \
{ \
- if (__builtin_expect (*((const uint32_t *) inptr) > 0x7f, 0)) \
+ if (__glibc_unlikely (*((const uint32_t *) inptr) > 0x7f)) \
{ \
UNICODE_TAG_HANDLER (*((const uint32_t *) inptr), 4); \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
@@ -883,10 +883,10 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
uint32_t wc = *((const uint32_t *) inptr); \
\
- if (__builtin_expect (wc < 0x80, 1)) \
+ if (__glibc_likely (wc < 0x80)) \
/* It's an one byte sequence. */ \
*outptr++ = (unsigned char) wc; \
- else if (__builtin_expect (wc <= 0x7fffffff, 1)) \
+ else if (__glibc_likely (wc <= 0x7fffffff)) \
{ \
size_t step; \
unsigned char *start; \
@@ -895,7 +895,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
if ((wc & (~(uint32_t)0 << (5 * step + 1))) == 0) \
break; \
\
- if (__builtin_expect (outptr + step > outend, 0)) \
+ if (__glibc_unlikely (outptr + step > outend)) \
{ \
/* Too long. */ \
result = __GCONV_FULL_OUTPUT; \
@@ -946,7 +946,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
/* Next input byte. */ \
uint32_t ch = *inptr; \
\
- if (__builtin_expect (ch < 0x80, 1)) \
+ if (__glibc_likely (ch < 0x80)) \
{ \
/* One byte sequence. */ \
++inptr; \
@@ -964,25 +964,25 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
cnt = 2; \
ch &= 0x1f; \
} \
- else if (__builtin_expect ((ch & 0xf0) == 0xe0, 1)) \
+ else if (__glibc_likely ((ch & 0xf0) == 0xe0)) \
{ \
/* We expect three bytes. */ \
cnt = 3; \
ch &= 0x0f; \
} \
- else if (__builtin_expect ((ch & 0xf8) == 0xf0, 1)) \
+ else if (__glibc_likely ((ch & 0xf8) == 0xf0)) \
{ \
/* We expect four bytes. */ \
cnt = 4; \
ch &= 0x07; \
} \
- else if (__builtin_expect ((ch & 0xfc) == 0xf8, 1)) \
+ else if (__glibc_likely ((ch & 0xfc) == 0xf8)) \
{ \
/* We expect five bytes. */ \
cnt = 5; \
ch &= 0x03; \
} \
- else if (__builtin_expect ((ch & 0xfe) == 0xfc, 1)) \
+ else if (__glibc_likely ((ch & 0xfe) == 0xfc)) \
{ \
/* We expect six bytes. */ \
cnt = 6; \
@@ -1003,7 +1003,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
STANDARD_FROM_LOOP_ERR_HANDLER (i); \
} \
\
- if (__builtin_expect (inptr + cnt > inend, 0)) \
+ if (__glibc_unlikely (inptr + cnt > inend)) \
{ \
/* We don't have enough input. But before we report that check \
that all the bytes are correct. */ \
@@ -1011,7 +1011,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
if ((inptr[i] & 0xc0) != 0x80) \
break; \
\
- if (__builtin_expect (inptr + i == inend, 1)) \
+ if (__glibc_likely (inptr + i == inend)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
@@ -1073,19 +1073,19 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
cnt = 2; \
ch &= 0x1f; \
} \
- else if (__builtin_expect ((ch & 0xf0) == 0xe0, 1)) \
+ else if (__glibc_likely ((ch & 0xf0) == 0xe0)) \
{ \
/* We expect three bytes. */ \
cnt = 3; \
ch &= 0x0f; \
} \
- else if (__builtin_expect ((ch & 0xf8) == 0xf0, 1)) \
+ else if (__glibc_likely ((ch & 0xf8) == 0xf0)) \
{ \
/* We expect four bytes. */ \
cnt = 4; \
ch &= 0x07; \
} \
- else if (__builtin_expect ((ch & 0xfc) == 0xf8, 1)) \
+ else if (__glibc_likely ((ch & 0xfc) == 0xf8)) \
{ \
/* We expect five bytes. */ \
cnt = 5; \
@@ -1164,7 +1164,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
uint16_t u1 = get16 (inptr); \
\
- if (__builtin_expect (u1 >= 0xd800 && u1 < 0xe000, 0)) \
+ if (__glibc_unlikely (u1 >= 0xd800 && u1 < 0xe000)) \
{ \
/* Surrogate characters in UCS-2 input are not valid. Reject \
them. (Catching this here is not security relevant.) */ \
@@ -1198,12 +1198,12 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
uint32_t val = *((const uint32_t *) inptr); \
\
- if (__builtin_expect (val >= 0x10000, 0)) \
+ if (__glibc_unlikely (val >= 0x10000)) \
{ \
UNICODE_TAG_HANDLER (val, 4); \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
- else if (__builtin_expect (val >= 0xd800 && val < 0xe000, 0)) \
+ else if (__glibc_unlikely (val >= 0xd800 && val < 0xe000)) \
{ \
/* Surrogate characters in UCS-4 input are not valid. \
We must catch this, because the UCS-2 output might be \
@@ -1248,7 +1248,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
uint16_t u1 = bswap_16 (get16 (inptr)); \
\
- if (__builtin_expect (u1 >= 0xd800 && u1 < 0xe000, 0)) \
+ if (__glibc_unlikely (u1 >= 0xd800 && u1 < 0xe000)) \
{ \
/* Surrogate characters in UCS-2 input are not valid. Reject \
them. (Catching this here is not security relevant.) */ \
@@ -1288,12 +1288,12 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
#define BODY \
{ \
uint32_t val = *((const uint32_t *) inptr); \
- if (__builtin_expect (val >= 0x10000, 0)) \
+ if (__glibc_unlikely (val >= 0x10000)) \
{ \
UNICODE_TAG_HANDLER (val, 4); \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
- else if (__builtin_expect (val >= 0xd800 && val < 0xe000, 0)) \
+ else if (__glibc_unlikely (val >= 0xd800 && val < 0xe000)) \
{ \
/* Surrogate characters in UCS-4 input are not valid. \
We must catch this, because the UCS-2 output might be \
diff --git a/iconv/iconv.c b/iconv/iconv.c
index 30b3564df5..a45b90ea4f 100644
--- a/iconv/iconv.c
+++ b/iconv/iconv.c
@@ -36,7 +36,7 @@ iconv (iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf,
size_t irreversible;
int result;
- if (__builtin_expect (inbuf == NULL || *inbuf == NULL, 0))
+ if (__glibc_unlikely (inbuf == NULL || *inbuf == NULL))
{
if (outbuf == NULL || *outbuf == NULL)
result = __gconv (gcd, NULL, NULL, NULL, NULL, &irreversible);
diff --git a/iconv/iconv_close.c b/iconv/iconv_close.c
index 1bf17939bf..304b4126b9 100644
--- a/iconv/iconv_close.c
+++ b/iconv/iconv_close.c
@@ -26,7 +26,7 @@
int
iconv_close (iconv_t cd)
{
- if (__builtin_expect (cd == (iconv_t *) -1L, 0))
+ if (__glibc_unlikely (cd == (iconv_t *) -1L))
{
__set_errno (EBADF);
return -1;
diff --git a/iconv/loop.c b/iconv/loop.c
index b4af6d418b..f836d08c37 100644
--- a/iconv/loop.c
+++ b/iconv/loop.c
@@ -241,7 +241,7 @@
/* If any of them recognized the input continue with the loop. */ \
if (result != __GCONV_ILLEGAL_INPUT) \
{ \
- if (__builtin_expect (result == __GCONV_FULL_OUTPUT, 0)) \
+ if (__glibc_unlikely (result == __GCONV_FULL_OUTPUT)) \
break; \
\
continue; \
@@ -442,7 +442,7 @@ SINGLE(LOOPFCT) (struct __gconv_step *step,
bytes from the state and at least one more, or the character is still
incomplete, or we have some other error (like illegal input character,
no space in output buffer). */
- if (__builtin_expect (inptr != bytebuf, 1))
+ if (__glibc_likely (inptr != bytebuf))
{
/* We found a new character. */
assert (inptr - bytebuf > (state->__count & 7));
diff --git a/iconv/skeleton.c b/iconv/skeleton.c
index 7743216835..14318a6a53 100644
--- a/iconv/skeleton.c
+++ b/iconv/skeleton.c
@@ -410,7 +410,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
/* If the function is called with no input this means we have to reset
to the initial state. The possibly partly converted input is
dropped. */
- if (__builtin_expect (do_flush, 0))
+ if (__glibc_unlikely (do_flush))
{
/* This should never happen during error handling. */
assert (outbufstart == NULL);
@@ -461,7 +461,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
if (result != __GCONV_EMPTY_INPUT)
{
- if (__builtin_expect (outerr != outbuf, 0))
+ if (__glibc_unlikely (outerr != outbuf))
{
/* We have a problem. Undo the conversion. */
outbuf = outstart;
@@ -604,7 +604,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
SAVE_RESET_STATE (1);
#endif
- if (__builtin_expect (!unaligned, 1))
+ if (__glibc_likely (!unaligned))
{
if (FROM_DIRECTION)
/* Run the conversion loop. */
@@ -635,7 +635,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
/* If we were called as part of an error handling module we
don't do anything else here. */
- if (__builtin_expect (outbufstart != NULL, 0))
+ if (__glibc_unlikely (outbufstart != NULL))
{
*outbufstart = outbuf;
return status;
@@ -653,7 +653,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
/* If this is the last step leave the loop, there is nothing
we can do. */
- if (__builtin_expect (data->__flags & __GCONV_IS_LAST, 0))
+ if (__glibc_unlikely (data->__flags & __GCONV_IS_LAST))
{
/* Store information about how many bytes are available. */
data->__outbuf = outbuf;
@@ -666,7 +666,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
}
/* Write out all output which was produced. */
- if (__builtin_expect (outbuf > outstart, 1))
+ if (__glibc_likely (outbuf > outstart))
{
const unsigned char *outerr = data->__outbuf;
int result;
@@ -677,7 +677,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
if (result != __GCONV_EMPTY_INPUT)
{
- if (__builtin_expect (outerr != outbuf, 0))
+ if (__glibc_unlikely (outerr != outbuf))
{
#ifdef RESET_INPUT_BUFFER
RESET_INPUT_BUFFER;
@@ -695,7 +695,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
SAVE_RESET_STATE (0);
# endif
- if (__builtin_expect (!unaligned, 1))
+ if (__glibc_likely (!unaligned))
{
if (FROM_DIRECTION)
/* Run the conversion loop. */
@@ -738,7 +738,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
/* If we haven't consumed a single byte decrement
the invocation counter. */
- if (__builtin_expect (outbuf == outstart, 0))
+ if (__glibc_unlikely (outbuf == outstart))
--data->__invocation_counter;
#endif /* reset input buffer */
}