about summary refs log tree commit diff
path: root/locale/weightwc.h
diff options
context:
space:
mode:
Diffstat (limited to 'locale/weightwc.h')
-rw-r--r--locale/weightwc.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/locale/weightwc.h b/locale/weightwc.h
index d0ca018e70..92bf47ab5f 100644
--- a/locale/weightwc.h
+++ b/locale/weightwc.h
@@ -24,19 +24,29 @@ findidx (const wint_t **cpp)
   int_fast32_t i;
   const wint_t *cp;
   wint_t ch;
-  size_t idx;
   size_t cnt = 0;
 
   ch = *(*cpp)++;
-  idx = ch % size;
-  while (names[idx] != ch)
+  if (size != 0)
     {
-      if (++cnt == layers)
-	/* We didn't find the name.  It is case for UNDEFINED.  */
-	return 0;
-      idx += size;
+      /* Old locale format.  */
+      size_t idx;
+
+      idx = ch % size;
+      while (names[idx] != ch)
+	{
+	  if (++cnt == layers)
+	    /* We didn't find the name.  It is case for UNDEFINED.  */
+	    return 0;
+	  idx += size;
+	}
+      i = table[idx];
+    }
+  else
+    {
+      /* New locale format.  */
+      i = collidx_table_lookup ((const char *) table, ch);
     }
-  i = table[idx];
 
   if (i >= 0)
     /* This is an index into the weight table.  Cool.  */