]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 6 Jun 2000 06:49:00 +0000 (06:49 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 6 Jun 2000 06:49:00 +0000 (06:49 +0000)
* iconvdata/big5hkscs.c: Add __builtin_expect in many places.
* iconvdata/big5.c: Likewise.
* iconvdata/ansi_x3.110.c: Likewise.
* iconvdata/8bit-generic.c: Likewise.
* iconvdata/8bit-gap.c: Likewise.
* iconv/loop.c: Likewise.
* iconv/gconv_db.c: Likewise.
* iconv/gconv_dl.c: Likewise.
* iconv/gconv_simple.c: Likewise.
* iconv/skeleton.c: Likewise.

ChangeLog
iconv/gconv_db.c
iconv/loop.c
iconvdata/8bit-gap.c
iconvdata/8bit-generic.c
iconvdata/ansi_x3.110.c
iconvdata/big5.c
iconvdata/big5hkscs.c

index 99a3aab1766e3d4f3e6f7013b8481f83de93e869..a10b231f525623a4fdda89b8e947e89b736b37d5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,15 @@
 2000-06-05  Ulrich Drepper  <drepper@redhat.com>
 
-       * iconv/gconv_dl.c: Add __builtin_expect in many places.
-       * iconv/skeleton.c: Add more __builtin_expect.
-       * iconv/gconv_simple.c: Add __builtin_expect in many places.
+       * iconvdata/big5hkscs.c: Add __builtin_expect in many places.
+       * iconvdata/big5.c: Likewise.
+       * iconvdata/ansi_x3.110.c: Likewise.
+       * iconvdata/8bit-generic.c: Likewise.
+       * iconvdata/8bit-gap.c: Likewise.
+       * iconv/loop.c: Likewise.
+       * iconv/gconv_db.c: Likewise.
+       * iconv/gconv_dl.c: Likewise.
+       * iconv/gconv_simple.c: Likewise.
+       * iconv/skeleton.c: Likewise.
 
        * iconv/gconv.h (__GCONV_IS_LAST, __GCONV_IGNORE_ERRORS): Define.
        (struct __gconv_step_data): Rename __is_last to __flags.
index f4a86e0cd060899986dce68454418464bc6c60f1..2e951294e4c7ce6c702ab42062d165c134343929 100644 (file)
@@ -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
index 9e8e32e8ccc62688583fd8b18dd92407659176ab..857c93de1e0aa38e917dbce6ba328683ce3a84bc 100644 (file)
@@ -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));
index c805d5e57c9c8283c12e4300cb5f744eb7a80e01..75493f758f2a6286f5b782a686b2df532bdbf05e 100644 (file)
@@ -48,7 +48,7 @@ struct gap
   {                                                                          \
     uint32_t ch = to_ucs4[*inptr];                                           \
                                                                              \
-    if (HAS_HOLES && ch == L'\0' && *inptr != '\0')                          \
+    if (HAS_HOLES && __builtin_expect (ch, L'\1') == L'\0' && *inptr != '\0') \
       {                                                                              \
        /* This is an illegal character.  */                                  \
        if (! ignore_errors_p ())                                             \
@@ -80,7 +80,7 @@ struct gap
     uint32_t ch = get32 (inptr);                                             \
     unsigned char res;                                                       \
                                                                              \
-    if (ch >= 0xffff)                                                        \
+    if (__builtin_expect (ch, 0) >= 0xffff)                                  \
       {                                                                              \
        /* This is an illegal character.  */                                  \
        if (! ignore_errors_p ())                                             \
@@ -95,7 +95,7 @@ struct gap
       }                                                                              \
     while (ch > rp->end)                                                     \
       ++rp;                                                                  \
-    if (ch < rp->start)                                                              \
+    if (__builtin_expect (ch < rp->start, 0))                                \
       {                                                                              \
        /* This is an illegal character.  */                                  \
        if (! ignore_errors_p ())                                             \
@@ -110,7 +110,7 @@ struct gap
       }                                                                              \
                                                                              \
     res = from_ucs4[ch + rp->idx];                                           \
-    if (ch != 0 && res == '\0')                                                      \
+    if (__builtin_expect (res, '\1') == '\0' && ch != 0)                     \
       {                                                                              \
        /* This is an illegal character.  */                                  \
        if (! ignore_errors_p ())                                             \
index 3b6b47abb115b7f9ced8bc0839e7eb32477f429f..398bd67ba4df2c2b66202c4837605e45abeeb0b3 100644 (file)
@@ -34,7 +34,7 @@
   {                                                                          \
     uint32_t ch = to_ucs4[*inptr];                                           \
                                                                              \
-    if (HAS_HOLES && ch == L'\0' && *inptr != '\0')                          \
+    if (HAS_HOLES && __builtin_expect (ch, L'\1') == L'\0' && *inptr != '\0') \
       {                                                                              \
        /* This is an illegal character.  */                                  \
        if (! ignore_errors_p ())                                             \
@@ -61,8 +61,8 @@
   {                                                                          \
     uint32_t ch = get32 (inptr);                                             \
                                                                              \
-    if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0])                     \
-       || (ch != 0 && from_ucs4[ch] == '\0'))                                \
+    if (__builtin_expect (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0]), 0)\
+       || (__builtin_expect (from_ucs4[ch], '\1') == '\0' && ch != 0))       \
       {                                                                              \
        /* This is an illegal character.  */                                  \
        if (! ignore_errors_p ())                                             \
index 94bd2e620e737e01f48be37ea51dc9e5fe39ee8c..bacbfd23adc89fd01d2a6d45c467809668db2374 100644 (file)
@@ -401,7 +401,7 @@ static const char from_ucs4[][2] =
     uint32_t ch = *inptr;                                                    \
     int incr;                                                                \
                                                                              \
-    if (ch >= 0xc1 && ch <= 0xcf)                                            \
+    if (__builtin_expect (ch, 0x00) >= 0xc1 && ch <= 0xcf)                   \
       {                                                                              \
        /* Composed character.  First test whether the next character         \
           is also available.  */                                             \
@@ -416,7 +416,8 @@ static const char from_ucs4[][2] =
                                                                              \
        ch2 = inptr[1];                                                       \
                                                                              \
-       if (ch2 < 0x20 || ch2 >= 0x80)                                        \
+       if (__builtin_expect (ch2, 0x20) < 0x20                               \
+           || __builtin_expect (ch2, 0x7f) >= 0x80)                          \
          {                                                                   \
            /* This is illegal.  */                                           \
            if (! ignore_errors_p ())                                         \
@@ -440,7 +441,7 @@ static const char from_ucs4[][2] =
        incr = 1;                                                             \
       }                                                                              \
                                                                              \
-    if (ch == 0 && *inptr != '\0')                                           \
+    if (__builtin_expect (ch, 1) == 0 && *inptr != '\0')                     \
       {                                                                              \
        /* This is an illegal character.  */                                  \
        if (! ignore_errors_p ())                                             \
@@ -471,7 +472,8 @@ static const char from_ucs4[][2] =
     uint32_t ch = get32 (inptr);                                             \
     const char *cp;                                                          \
                                                                              \
-    if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0]))                    \
+    if (__builtin_expect (ch, 0)                                             \
+       >= sizeof (from_ucs4) / sizeof (from_ucs4[0]))                        \
       {                                                                              \
        if (ch == 0x2c7)                                                      \
          cp = "\xcf\x20";                                                    \
@@ -536,7 +538,7 @@ static const char from_ucs4[][2] =
            tmp[1] = '\0';                                                    \
            cp = tmp;                                                         \
          }                                                                   \
-       else if (ch == 0x266a)                                                \
+       else if (__builtin_expect (ch, 0x266a) == 0x266a)                     \
          cp = "\xd5";                                                        \
        else                                                                  \
          {                                                                   \
@@ -556,7 +558,7 @@ static const char from_ucs4[][2] =
       {                                                                              \
        cp = from_ucs4[ch];                                                   \
                                                                              \
-       if (cp[0] == '\0' && ch != 0)                                         \
+       if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0)                \
          {                                                                   \
            /* Illegal characters.  */                                        \
            if (! ignore_errors_p ())                                         \
@@ -575,7 +577,7 @@ static const char from_ucs4[][2] =
     /* Now test for a possible second byte and write this if possible.  */    \
     if (cp[1] != '\0')                                                       \
       {                                                                              \
-       if (NEED_LENGTH_TEST && outptr >= outend)                             \
+       if (NEED_LENGTH_TEST && __builtin_expect (outptr >= outend, 0))       \
          {                                                                   \
            /* The result does not fit into the buffer.  */                   \
            --outptr;                                                         \
index 0e4ca7464af928dbae0c314d509babaa5bf32c17..363b2506d657141232682afd9b5ed989ed6a1142 100644 (file)
@@ -8450,7 +8450,8 @@ static const char from_ucs4_tab13[][2] =
        /* See whether the second byte is in the correct range.  */           \
        if (ch2 >= 0x40 && ch2 <= 0x7e)                                       \
          idx += ch2 - 0x40;                                                  \
-       else if (ch2 >= 0xa1 && ch2 <= 0xfe)                                  \
+       else if (__builtin_expect (ch2, 0xa1) >= 0xa1                         \
+                && __builtin_expect (ch2, 0xa1) <= 0xfe)                     \
          idx += 0x3f + (ch2 - 0xa1);                                         \
        else                                                                  \
          {                                                                   \
@@ -8470,7 +8471,7 @@ static const char from_ucs4_tab13[][2] =
        ch = big5_to_ucs[idx];                                                \
                                                                              \
        /* Is this character defined?  */                                     \
-       if (ch == 0 && *inptr != '\0')                                        \
+       if (__builtin_expect (ch, 1) == 0 && *inptr != '\0')                  \
          {                                                                   \
            /* This is an illegal character.  */                              \
            if (! ignore_errors_p ())                                         \
@@ -8506,7 +8507,8 @@ static const char from_ucs4_tab13[][2] =
     char buf[2];                                                             \
     const char *cp;                                                          \
                                                                              \
-    if (ch >= sizeof (from_ucs4_tab1) / sizeof (from_ucs4_tab1[0]))          \
+    if (__builtin_expect (ch, 0)                                             \
+       >= sizeof (from_ucs4_tab1) / sizeof (from_ucs4_tab1[0]))              \
       switch (ch)                                                            \
        {                                                                     \
         case 0x2c7 ... 0x2d9:                                                \
@@ -8578,7 +8580,7 @@ static const char from_ucs4_tab13[][2] =
     else                                                                     \
       cp = from_ucs4_tab1[ch];                                               \
                                                                              \
-    if (cp[0] == '\0' && ch != 0)                                            \
+    if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0)                   \
       {                                                                              \
        /* Illegal character.  */                                             \
        if (! ignore_errors_p ())                                             \
@@ -8592,7 +8594,8 @@ static const char from_ucs4_tab13[][2] =
     else                                                                     \
       {                                                                              \
        /* See whether there is enough room for the second byte we write.  */ \
-       if (NEED_LENGTH_TEST && cp[1] != '\0' && outptr + 1 >= outend)        \
+       if (NEED_LENGTH_TEST && __builtin_expect (cp[1], '\1') != '\0'        \
+           && __builtin_expect (outptr + 1 >= outend, 0))                    \
          {                                                                   \
            /* We have not enough room.  */                                   \
            result = __GCONV_FULL_OUTPUT;                                     \
index 09974d5523917dcba0496495c45eca5c2def940e..083b077c9407ec007b813eec9703212d9d72aa4d 100644 (file)
@@ -12604,7 +12604,8 @@ static const char from_ucs4_tab14[][2] =
        /* See whether the second byte is in the correct range.  */           \
        if (ch2 >= 0x40 && ch2 <= 0x7e)                                       \
          idx += ch2 - 0x40;                                                  \
-       else if (ch2 >= 0xa1 && ch2 <= 0xfe)                                  \
+       else if (__builtin_expect (ch2, 0xa1) >= 0xa1                         \
+                && __builtin_expect (ch2, 0xa1) <= 0xfe)                     \
          idx += 0x3f + (ch2 - 0xa1);                                         \
        else                                                                  \
          {                                                                   \
@@ -12624,7 +12625,7 @@ static const char from_ucs4_tab14[][2] =
        ch = big5_to_ucs[idx];                                                \
                                                                              \
        /* Is this character defined?  */                                     \
-       if (ch == 0 && *inptr != '\0')                                        \
+       if (__builtin_expect (ch, 1) == 0 && *inptr != '\0')                  \
          {                                                                   \
            /* This is an illegal character.  */                              \
            if (! ignore_errors_p ())                                         \
@@ -12660,7 +12661,8 @@ static const char from_ucs4_tab14[][2] =
     char buf[2];                                                             \
     const char *cp;                                                          \
                                                                              \
-    if (ch >= sizeof (from_ucs4_tab1) / sizeof (from_ucs4_tab1[0]))          \
+    if (__builtin_expect (ch, 0)                                             \
+       >= sizeof (from_ucs4_tab1) / sizeof (from_ucs4_tab1[0]))              \
       switch (ch)                                                            \
        {                                                                     \
         case 0x2c7 ... 0x2d9:                                                \
@@ -12735,7 +12737,7 @@ static const char from_ucs4_tab14[][2] =
     else                                                                     \
       cp = from_ucs4_tab1[ch];                                               \
                                                                              \
-    if (cp[0] == '\0' && ch != 0)                                            \
+    if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0)                   \
       {                                                                              \
        /* Illegal character.  */                                             \
        if (! ignore_errors_p ())                                             \
@@ -12749,7 +12751,8 @@ static const char from_ucs4_tab14[][2] =
     else                                                                     \
       {                                                                              \
        /* See whether there is enough room for the second byte we write.  */ \
-       if (NEED_LENGTH_TEST && cp[1] != '\0' && outptr + 1 >= outend)        \
+       if (NEED_LENGTH_TEST && __builtin_expect (cp[1], '\1') != '\0'        \
+           && __builtin_expect (outptr + 1 >= outend, 0))                    \
          {                                                                   \
            /* We have not enough room.  */                                   \
            result = __GCONV_FULL_OUTPUT;                                     \
This page took 0.068573 seconds and 5 git commands to generate.