for (idx = 0; idx < 128; ++idx)
for (idx = 0; idx < 127; ++idx)
allocate_arrays (struct locale_ctype_t *ctype){  size_t idx;  /* First we have to decide how we organize the arrays.  It is easy for     a one-byte character set.  But multi-byte character set cannot be     stored flat because they might be sparsly used.  So we determine an     optimal hashing function for the used characters.     We use a very trivial hashing function to store the sparse table.     CH % TABSIZE is used as an index.  To solve multiple hits we have     N planes.  This gurantees a fixed search time for a character [N     / 2].  In the following code we determine the minmum value for     TABSIZE * N, where TABSIZE >= 256.  */  size_t min_total = UINT_MAX;  size_t act_size = 256;  fputs (_("\Computing table size for character classes might take a while..."),	 stderr);  while (act_size < min_total)    {      size_t cnt[act_size];      size_t act_planes = 1;      memset (cnt, '\0', sizeof cnt);      for (idx = 0; idx < 256; ++idx)	cnt[idx] = 1;      for (idx = 0; idx < ctype->charnames_act; ++idx)	if (ctype->charnames[idx] >= 256)	  {	    size_t nr = ctype->charnames[idx] % act_size;	    if (++cnt[nr] > act_planes)	      {		act_planes = cnt[nr];		if (act_size * act_planes >= min_total)		  break;	      }	  }      if (act_size * act_planes < min_total)	{	  min_total = act_size * act_planes;	  ctype->plane_size = act_size;	  ctype->plane_cnt = act_planes;	}      ++act_size;    }  fprintf (stderr, _(" done\n"));#if __BYTE_ORDER == __LITTLE_ENDIAN# define NAMES_B1 ctype->names_el# define NAMES_B2 ctype->names_eb#else# define NAMES_B1 ctype->names_eb# define NAMES_B2 ctype->names_el#endif  ctype->names_eb = (u32_t *) xcalloc (ctype->plane_size * ctype->plane_cnt,				       sizeof (u32_t));  ctype->names_el = (u32_t *) xcalloc (ctype->plane_size * ctype->plane_cnt,				       sizeof (u32_t));  for (idx = 1; idx < 256; ++idx)    NAMES_B1[idx] = idx;  /* Trick: change the 0th entry's name to 1 to mark the cell occupied.  */  NAMES_B1[0] = 1;  for (idx = 256; idx < ctype->charnames_act; ++idx)    {      size_t nr = (ctype->charnames[idx] % ctype->plane_size);      size_t depth = 0;      while (NAMES_B1[nr + depth * ctype->plane_size])	++depth;      assert (depth < ctype->plane_cnt);      NAMES_B1[nr + depth * ctype->plane_size] = ctype->charnames[idx];      /* Now for faster access remember the index in the NAMES_B array.  */      ctype->charnames[idx] = nr + depth * ctype->plane_size;    }  NAMES_B1[0] = 0;  for (idx = 0; idx < ctype->plane_size * ctype->plane_cnt; ++idx)    NAMES_B2[idx] = SWAPU32 (NAMES_B1[idx]);  /* You wonder about this amount of memory?  This is only because some     users do not manage to address the array with unsigned values or     data types with range >= 256.  '\200' would result in the array     index -128.  To help these poor people we duplicate the entries for     128 up to 255 below the entry for \0.  */  ctype->ctype_b = (char_class_t *) xcalloc (256 + 128,					     sizeof (char_class_t));  ctype->ctype32_b = (char_class32_t *) xcalloc (ctype->plane_size						 * ctype->plane_cnt,						 sizeof (char_class32_t));  /* Fill in the character class information.  */#if __BYTE_ORDER == __LITTLE_ENDIAN# define TRANS(w) CHAR_CLASS_TRANS (w)# define TRANS32(w) CHAR_CLASS32_TRANS (w)#else# define TRANS(w) (w)# define TRANS32(w) (w)#endif  for (idx = 0; idx < ctype->class_collection_act; ++idx)    if (ctype->charnames[idx] < 256)      ctype->ctype_b[128 + ctype->charnames[idx]]	= TRANS (ctype->class_collection[idx]);  /* Mirror first 128 entries.  */  for (idx = 0; idx < 128; ++idx)    ctype->ctype_b[idx] = ctype->ctype_b[256 + idx];  /* The 32 bit array contains all characters.  */  for (idx = 0; idx < ctype->class_collection_act; ++idx)    ctype->ctype32_b[ctype->charnames[idx]]      = TRANS32 (ctype->class_collection[idx]);  /* Room for table of mappings.  */  ctype->map_eb = (u32_t **) xmalloc (ctype->map_collection_nr				      * sizeof (u32_t *));  ctype->map_el = (u32_t **) xmalloc (ctype->map_collection_nr				      * sizeof (u32_t *));  /* Fill in all mappings.  */  for (idx = 0; idx < ctype->map_collection_nr; ++idx)    {      unsigned int idx2;      /* Allocate table.  */      ctype->map_eb[idx] = (u32_t *) xmalloc ((ctype->plane_size					       * ctype->plane_cnt + 128)					      * sizeof (u32_t));      ctype->map_el[idx] = (u32_t *) xmalloc ((ctype->plane_size					       * ctype->plane_cnt + 128)					      * sizeof (u32_t));#if __BYTE_ORDER == __LITTLE_ENDIAN# define MAP_B1 ctype->map_el# define MAP_B2 ctype->map_eb#else# define MAP_B1 ctype->map_eb# define MAP_B2 ctype->map_el#endif      /* Copy default value (identity mapping).  */      memcpy (&MAP_B1[idx][128], NAMES_B1,	      ctype->plane_size * ctype->plane_cnt * sizeof (u32_t));      /* Copy values from collection.  */      for (idx2 = 0; idx2 < ctype->map_collection_act[idx]; ++idx2)	if (ctype->map_collection[idx][idx2] != 0)	  MAP_B1[idx][128 + ctype->charnames[idx2]] =	    ctype->map_collection[idx][idx2];      /* Mirror first 128 entries.  */      for (idx2 = 0; idx2 < 128; ++idx2)	MAP_B1[idx][idx2] = MAP_B1[idx][256 + idx2];      /* And now the other byte order.  */      for (idx2 = 0; idx2 < ctype->plane_size * ctype->plane_cnt + 128; ++idx2)	MAP_B2[idx][idx2] = SWAPU32 (MAP_B1[idx][idx2]);    }  /* Extra array for class and map names.  */  ctype->class_name_ptr = (u32_t *) xmalloc (ctype->nr_charclass					     * sizeof (u32_t));  ctype->map_name_ptr = (u32_t *) xmalloc (ctype->map_collection_nr					   * sizeof (u32_t));}