aboutsummaryrefslogtreecommitdiff
path: root/iconvdata/gbk.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-06 16:53:06 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-06 16:53:06 +0000
commit89301d683e7401cb7cfcb6ebc89be6593d4c809f (patch)
tree5fcc96e30f608b81ac5a5cee239b6f4327f0a339 /iconvdata/gbk.c
parent5ea1a82defd37feaa6be1faf44854364c901cdaf (diff)
downloadglibc-89301d683e7401cb7cfcb6ebc89be6593d4c809f.tar
glibc-89301d683e7401cb7cfcb6ebc89be6593d4c809f.tar.gz
glibc-89301d683e7401cb7cfcb6ebc89be6593d4c809f.tar.bz2
glibc-89301d683e7401cb7cfcb6ebc89be6593d4c809f.zip
Update.
2000-06-06 Ulrich Drepper <drepper@redhat.com> * iconvdata/iso-2022-kr.c: Add __builtin_expect in many places. * iconvdata/iso-2022-jp.c: Likewise. * iconvdata/iso-2022-cn.c: Likewise. * iconvdata/gbgbk.c: Likewise. * iconvdata/gbk.c: Likewise. * iconvdata/euc-kr.c: Likewise. * iconvdata/euc-jp.c: Likewise. * iconvdata/euc-cn.c: Likewise.
Diffstat (limited to 'iconvdata/gbk.c')
-rw-r--r--iconvdata/gbk.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/iconvdata/gbk.c b/iconvdata/gbk.c
index c120df08a1..405a3f8b23 100644
--- a/iconvdata/gbk.c
+++ b/iconvdata/gbk.c
@@ -13121,7 +13121,8 @@ static const char __gbk_from_ucs4_tab12[][2] =
if (ch <= 0x7f) \
++inptr; \
else \
- if (ch <= 0x80 || ch > 0xfe) \
+ if (__builtin_expect (ch, 0x81) <= 0x80 \
+ || __builtin_expect (ch, 0x81) > 0xfe) \
{ \
/* This is illegal. */ \
if (! ignore_errors_p ()) \
@@ -13141,7 +13142,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
uint32_t ch2; \
int idx; \
\
- if (NEED_LENGTH_TEST && inptr + 1 >= inend) \
+ if (NEED_LENGTH_TEST && __builtin_expect (inptr + 1 >= inend, 0)) \
{ \
/* The second character is not available. Store \
the intermediate result. */ \
@@ -13152,7 +13153,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
ch2 = inptr[1]; \
\
/* All second bytes of a multibyte character must be >= 0x40. */ \
- if (ch2 < 0x40) \
+ if (__builtin_expect (ch2, 0x41) < 0x40) \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
@@ -13172,7 +13173,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
\
ch = __gbk_to_ucs[idx]; \
\
- if (ch == 0 && *inptr != '\0') \
+ if (__builtin_expect (ch, 1) == 0 && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
@@ -13446,7 +13447,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
cp = ""; \
break; \
} \
- if (cp == NULL || (cp[0] == '\0' && ch != 0)) \
+ if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
{ \
/* Illegal character. */ \
if (! ignore_errors_p ()) \
@@ -13458,7 +13459,8 @@ static const char __gbk_from_ucs4_tab12[][2] =
++*converted; \
} \
/* See whether there is enough room for the second byte we write. */ \
- else if (NEED_LENGTH_TEST && cp[1] != '\0' && outptr + 1 >= outend) \
+ else if (NEED_LENGTH_TEST && cp[1] != '\0' \
+ && __builtin_expect (outptr + 1 >= outend, 0)) \
{ \
/* We have not enough room. */ \
result = __GCONV_FULL_OUTPUT; \