about summary refs log tree commit diff
path: root/wcsmbs/wcwidth.h
diff options
context:
space:
mode:
Diffstat (limited to 'wcsmbs/wcwidth.h')
-rw-r--r--wcsmbs/wcwidth.h37
1 files changed, 7 insertions, 30 deletions
diff --git a/wcsmbs/wcwidth.h b/wcsmbs/wcwidth.h
index 86a2f216bd..d13a5f59ae 100644
--- a/wcsmbs/wcwidth.h
+++ b/wcsmbs/wcwidth.h
@@ -20,48 +20,25 @@
 
 #include <wchar.h>
 #include <wctype.h>
-#include "../wctype/cname-lookup.h"
 #include "../wctype/wchar-lookup.h"
 
 /* Tables containing character property information.  */
 extern const char *__ctype32_wctype[12];
 
-/* Tables containing width information.  */
-extern unsigned char *__ctype_width;
+/* Table containing width information.  */
 extern const char *__ctype32_width;
 
-/* If the program is compiled without optimization the following declaration
-   is not visible in the header.   */
-extern unsigned int *__ctype32_b;
-
 static __inline int
 internal_wcwidth (wint_t wc)
 {
+  unsigned char res;
+
   if (wc == L'\0')
     return 0;
 
-  if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE) != 0)
-    {
-      /* Old locale format.  */
-      size_t idx;
-      unsigned char res;
-
-      idx = cname_lookup (wc);
-      if (idx == ~((size_t) 0) || (__ctype32_b[idx] & _ISwprint) == 0)
-	return -1;
-
-      res = __ctype_width[idx];
-      return res == (unsigned char) '\xff' ? -1 : (int) res;
-    }
-  else
-    {
-      /* New locale format.  */
-      unsigned char res;
-
-      if (wctype_table_lookup (__ctype32_wctype[__ISwprint], wc) == 0)
-	return -1;
+  if (wctype_table_lookup (__ctype32_wctype[__ISwprint], wc) == 0)
+    return -1;
 
-      res = wcwidth_table_lookup (__ctype32_width, wc);
-      return res == (unsigned char) '\xff' ? -1 : (int) res;
-    }
+  res = wcwidth_table_lookup (__ctype32_width, wc);
+  return res == (unsigned char) '\xff' ? -1 : (int) res;
 }