diff options
Diffstat (limited to 'iconv')
-rw-r--r-- | iconv/gconv_db.c | 8 | ||||
-rw-r--r-- | iconv/loop.c | 11 |
2 files changed, 11 insertions, 8 deletions
diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c index f4a86e0cd0..2e951294e4 100644 --- a/iconv/gconv_db.c +++ b/iconv/gconv_db.c @@ -1,5 +1,5 @@ /* Provide access to the collection of available transformation modules. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -239,7 +239,7 @@ gen_steps (struct derivation_step *best, const char *toset, status = DL_CALL_FCT (result[step_cnt].__init_fct, (&result[step_cnt])); - if (status != __GCONV_OK) + if (__builtin_expect (status, __GCONV_OK) != __GCONV_OK) { failed = 1; /* Make sure we unload this modules. */ @@ -251,7 +251,7 @@ gen_steps (struct derivation_step *best, const char *toset, current = current->last; } - if (failed != 0) + if (__builtin_expect (failed, 0) != 0) { /* Something went wrong while initializing the modules. */ while (++step_cnt < *nsteps) @@ -670,7 +670,7 @@ __gconv_find_transform (const char *toset, const char *fromset, toset_expand = found != NULL ? (*found)->toname : NULL; } - if ((flags & GCONV_AVOID_NOCONV) + if (__builtin_expect (flags & GCONV_AVOID_NOCONV, 0) /* We are not supposed to create a pseudo transformation (means copying) when the input and output character set are the same. */ && (strcmp (toset, fromset) == 0 diff --git a/iconv/loop.c b/iconv/loop.c index 9e8e32e8cc..857c93de1e 100644 --- a/iconv/loop.c +++ b/iconv/loop.c @@ -232,14 +232,17 @@ FCTNAME (LOOPFCT) (const unsigned char **inptrp, const unsigned char *inend, /* `if' cases for MIN_NEEDED_OUTPUT ==/!= 1 is made to help the compiler generating better code. It will optimized away since MIN_NEEDED_OUTPUT is always a constant. */ - if ((MIN_NEEDED_OUTPUT != 1 && outptr + MIN_NEEDED_OUTPUT > outend) - || (MIN_NEEDED_OUTPUT == 1 && outptr >= outend)) + if ((MIN_NEEDED_OUTPUT != 1 + && __builtin_expect (outptr + MIN_NEEDED_OUTPUT > outend, 0)) + || (MIN_NEEDED_OUTPUT == 1 + && __builtin_expect (outptr >= outend, 0))) { /* Overflow in the output buffer. */ result = __GCONV_FULL_OUTPUT; break; } - if (MIN_NEEDED_INPUT > 1 && inptr + MIN_NEEDED_INPUT > inend) + if (MIN_NEEDED_INPUT > 1 + && __builtin_expect (inptr + MIN_NEEDED_INPUT > inend, 0)) { /* We don't have enough input for another complete input character. */ @@ -356,7 +359,7 @@ SINGLE(LOOPFCT) (const unsigned char **inptrp, const unsigned char *inend, 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 (inptr != bytebuf) + if (__builtin_expect (inptr != bytebuf, 1)) { /* We found a new character. */ assert (inptr - bytebuf > (state->__count & 7)); |