about summary refs log tree commit diff
path: root/locale/programs/ld-ctype.c
diff options
context:
space:
mode:
Diffstat (limited to 'locale/programs/ld-ctype.c')
-rw-r--r--locale/programs/ld-ctype.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 96124988ce..c4a6f7ba64 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -108,6 +108,7 @@ struct locale_ctype_t
   u_int32_t *class_name_ptr;
   u_int32_t *map_name_ptr;
   unsigned char *width;
+  u_int32_t mb_cur_max;
 };
 
 
@@ -471,6 +472,9 @@ ctype_output (struct localedef_t *locale, struct charset_t *charset,
 	  CTYPE_DATA (_NL_CTYPE_WIDTH,
 		      ctype->width, ctype->plane_size * ctype->plane_cnt);
 
+	  CTYPE_DATA (_NL_CTYPE_MB_CUR_MAX,
+		      &ctype->mb_cur_max, sizeof (u_int32_t));
+
 	  default:
 	    assert (! "unknown CTYPE element");
 	  }
@@ -1372,4 +1376,10 @@ Computing table size for character classes might take a while..."),
 		= charset->width_rules[cnt].width;
 	    }
     }
+
+  /* Compute MB_CUR_MAX.  Please note the value mb_cur_max in the
+     character set definition gives the number of bytes in the wide
+     character representation.  We compute the number of bytes used
+     for the UTF-8 encoded form.  */
+  ctype->mb_cur_max = ((int []) { 2, 3, 5, 6 }) [charset->mb_cur_max - 1];
 }