about summary refs log tree commit diff
path: root/iconvdata/uhc.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconvdata/uhc.c')
-rw-r--r--iconvdata/uhc.c62
1 files changed, 13 insertions, 49 deletions
diff --git a/iconvdata/uhc.c b/iconvdata/uhc.c
index 51e38dcac6..87247689c9 100644
--- a/iconvdata/uhc.c
+++ b/iconvdata/uhc.c
@@ -1,5 +1,5 @@
 /* Mapping tables for UHC handling.
-   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jungshik Shin <jshin@pantheon.yale.edu>, 1998.
 
@@ -3069,16 +3069,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
 	     || __builtin_expect (ch == 0xc9, 0))			      \
       {									      \
 	/* This is illegal.  */						      \
-	if (! ignore_errors_p ())					      \
-	  {								      \
-	    /* This is an illegal character.  */			      \
-	    result = __GCONV_ILLEGAL_INPUT;				      \
-	    break;							      \
-	  }								      \
-									      \
-	++inptr;							      \
-	++*irreversible;						      \
-	continue;							      \
+	STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
       }									      \
     else								      \
       {									      \
@@ -3124,16 +3115,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
 		|| (__builtin_expect (ch == 0xc6, 0) && ch2 > 0x52))	      \
 	      {								      \
 		/* This is not legal.  */				      \
-		if (! ignore_errors_p ())				      \
-		  {							      \
-		    /* This is an illegal character.  */		      \
-		    result = __GCONV_ILLEGAL_INPUT;			      \
-		    break;						      \
-		  }							      \
-									      \
-		++inptr;						      \
-		++*irreversible;					      \
-		continue;						      \
+		STANDARD_FROM_LOOP_ERR_HANDLER (1);			      \
 	      }								      \
 									      \
 	    ch = uhc_extra_to_ucs[ch2 - 0x41				      \
@@ -3142,19 +3124,10 @@ static const char uhc_hangul_from_ucs[11172][2] =
 				     ? (ch - 0x81) * 178		      \
 				     : 5696 + (ch - 0xa1) * 84)];	      \
 									      \
-	    if (__builtin_expect (ch, 1) == 0)				      \
+	    if (__builtin_expect (ch == 0, 0))				      \
 	      {								      \
 		/* This is an illegal character.  */			      \
-		if (! ignore_errors_p ())				      \
-		  {							      \
-		    /* This is an illegal character.  */		      \
-		    result = __GCONV_ILLEGAL_INPUT;			      \
-		    break;						      \
-		  }							      \
-									      \
-		inptr += 2;						      \
-		++*irreversible;					      \
-		continue;						      \
+		STANDARD_FROM_LOOP_ERR_HANDLER (2);			      \
 	      }								      \
 									      \
 	    inptr += 2;							      \
@@ -3162,19 +3135,10 @@ static const char uhc_hangul_from_ucs[11172][2] =
 	else								      \
 	  {								      \
 	    ch = ksc5601_to_ucs4 (&inptr, 2, 0x80);			      \
-	    if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR)	      \
+	    if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))	      \
 	      {								      \
 		/* Illegal.  */						      \
-		if (! ignore_errors_p ())				      \
-		  {							      \
-		    /* This is an illegal character.  */		      \
-		    result = __GCONV_ILLEGAL_INPUT;			      \
-		    break;						      \
-		  }							      \
-									      \
-		inptr += 2;						      \
-		++*irreversible;					      \
-		continue;						      \
+		STANDARD_FROM_LOOP_ERR_HANDLER (2);			      \
 	      }								      \
 	  }								      \
       }									      \
@@ -3215,14 +3179,14 @@ static const char uhc_hangul_from_ucs[11172][2] =
       {									      \
 	size_t written = ucs4_to_ksc5601_hanja (ch, outptr, outend - outptr); \
 									      \
-	if (__builtin_expect (written, 1) == 0)				      \
+	if (__builtin_expect (written == 0, 0))				      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
 	  }								      \
-	if (__builtin_expect (written, 0) == __UNKNOWN_10646_CHAR)	      \
+	if (__builtin_expect (written == __UNKNOWN_10646_CHAR, 0))	      \
 	  {								      \
-	    STANDARD_ERR_HANDLER (4);					      \
+	    STANDARD_TO_LOOP_ERR_HANDLER (4);				      \
 	  }								      \
 									      \
 	*outptr++ |= 0x80;						      \
@@ -3236,15 +3200,15 @@ static const char uhc_hangul_from_ucs[11172][2] =
       {									      \
 	size_t written = ucs4_to_ksc5601_sym (ch, outptr, outend - outptr);   \
 									      \
-	if (__builtin_expect (written, 1) == 0)				      \
+	if (__builtin_expect (written == 0, 0))				      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
 	  }								      \
-	if (__builtin_expect (written, 0) == __UNKNOWN_10646_CHAR)	      \
+	if (__builtin_expect (written == __UNKNOWN_10646_CHAR, 0))	      \
 	  {								      \
 	    UNICODE_TAG_HANDLER (ch, 4);				      \
-	    STANDARD_ERR_HANDLER (4);					      \
+	    STANDARD_TO_LOOP_ERR_HANDLER (4);				      \
 	  }								      \
 									      \
 	*outptr++ |= 0x80;						      \