summary refs log tree commit diff
path: root/iconvdata/ibm943.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconvdata/ibm943.c')
-rw-r--r--iconvdata/ibm943.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/iconvdata/ibm943.c b/iconvdata/ibm943.c
index bf387bbc3e..daeac1d8b2 100644
--- a/iconvdata/ibm943.c
+++ b/iconvdata/ibm943.c
@@ -1,5 +1,5 @@
 /* Conversion from and to IBM943.
-   Copyright (C) 2000-2002 Free Software Foundation, Inc.
+   Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2000.
 
@@ -170,20 +170,21 @@
 	high = (sizeof (__ucs4_to_ibm943db) >> 1)			      \
 		/ sizeof (__ucs4_to_ibm943db[0][FROM]);			      \
 	pccode = ch;							      \
-	while (low <= high)						      \
-	  {								      \
-	    i = (low + high) >> 1;					      \
-	    if (pccode < __ucs4_to_ibm943db[i][FROM])			      \
-	      high = i - 1;						      \
-	    else if (pccode > __ucs4_to_ibm943db[i][FROM])		      \
-	      low = i + 1;						      \
-	    else 							      \
-	      {								      \
-		pccode = __ucs4_to_ibm943db[i][TO];			      \
-		found = true;						      \
-		break;							      \
-	      }								      \
-	  }								      \
+	if (__builtin_expect (rp != NULL, 1))				      \
+	  while (low < high)						      \
+	    {								      \
+	      i = (low + high) >> 1;					      \
+	      if (pccode < __ucs4_to_ibm943db[i][FROM])			      \
+		high = i;						      \
+	      else if (pccode > __ucs4_to_ibm943db[i][FROM])		      \
+		low = i + 1;						      \
+	      else 							      \
+		{							      \
+		  pccode = __ucs4_to_ibm943db[i][TO];			      \
+		  found = true;						      \
+		  break;						      \
+		}							      \
+	    }								      \
 	if (found) 							      \
 	  {								      \
 	    if (__builtin_expect (outptr + 2 > outend, 0))		      \