about summary refs log tree commit diff
path: root/locale/programs
diff options
context:
space:
mode:
Diffstat (limited to 'locale/programs')
-rw-r--r--locale/programs/charset.h2
-rw-r--r--locale/programs/config.h1
-rw-r--r--locale/programs/ld-collate.c51
-rw-r--r--locale/programs/ld-ctype.c116
-rw-r--r--locale/programs/ld-messages.c2
-rw-r--r--locale/programs/ld-monetary.c2
-rw-r--r--locale/programs/ld-numeric.c2
-rw-r--r--locale/programs/ld-time.c2
-rw-r--r--locale/programs/localedef.c48
9 files changed, 128 insertions, 98 deletions
diff --git a/locale/programs/charset.h b/locale/programs/charset.h
index 1e8819c662..2885bf1d1a 100644
--- a/locale/programs/charset.h
+++ b/locale/programs/charset.h
@@ -53,7 +53,7 @@ struct charset_t
 /* We need one value to mark the error case.  Let's use 0xffffffff.
    I.e., it is placed in the last page of ISO 10646.  For now only the
    first is used and we have plenty of room.  */
-#define ILLEGAL_CHAR_VALUE 0xffffffffu
+#define ILLEGAL_CHAR_VALUE ((wchar_t) 0xffffffffu)
 
 
 /* Prototypes for charmap handling functions.  */
diff --git a/locale/programs/config.h b/locale/programs/config.h
index 4aa406d755..6c67813f93 100644
--- a/locale/programs/config.h
+++ b/locale/programs/config.h
@@ -24,7 +24,6 @@
 
 
 typedef int wint_t;
-typedef unsigned short int u16_t;
 
 
 #include_next <config.h>
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 598b963fc0..6643ae85c8 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -253,7 +253,7 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
       |* XXX We should test whether really an unspecified character *|
       |* exists before giving the message.			    *|
       \**************************************************************/
-      u32_t weight;
+      u_int32_t weight;
 
       error (0, 0, _("no definition of `UNDEFINED'"));
 
@@ -262,7 +262,7 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
 
       for (cnt = 0; cnt < collate->nrules; ++cnt)
 	{
-	  u32_t one = 1;
+	  u_int32_t one = 1;
 	  obstack_grow (&collate->element_mem, &one, sizeof (one));
 	}
 
@@ -286,7 +286,7 @@ void
 collate_output (struct localedef_t *locale, const char *output_path)
 {
   struct locale_collate_t *collate = locale->categories[LC_COLLATE].collate;
-  u32_t table_size, table_best, level_best, sum_best;
+  u_int32_t table_size, table_best, level_best, sum_best;
   void *last;
   element_t *pelem;
   wchar_t *name;
@@ -294,11 +294,11 @@ collate_output (struct localedef_t *locale, const char *output_path)
   const size_t nelems = _NL_ITEM_INDEX (_NL_NUM_LC_COLLATE);
   struct iovec iov[2 + nelems];
   struct locale_file data;
-  u32_t idx[nelems];
+  u_int32_t idx[nelems];
   struct obstack non_simple;
   size_t cnt, entry_size;
-  u32_t undefined_offset = UINT_MAX;
-  u32_t *table, *extra, *table2, *extra2;
+  u_int32_t undefined_offset = UINT_MAX;
+  u_int32_t *table, *extra, *table2, *extra2;
   size_t extra_len;
 
   sum_best = UINT_MAX;
@@ -352,12 +352,12 @@ Computing table size for collation information might take a while..."),
   iov[1].iov_len = sizeof (idx);
 
   iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_NRULES)].iov_base = &collate->nrules;
-  iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_NRULES)].iov_len = sizeof (u32_t);
+  iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_NRULES)].iov_len = sizeof (u_int32_t);
 
-  table = (u32_t *) alloca (collate->nrules * sizeof (u32_t));
+  table = (u_int32_t *) alloca (collate->nrules * sizeof (u_int32_t));
   iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_RULES)].iov_base = table;
   iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_RULES)].iov_len
-    = collate->nrules * sizeof (u32_t);
+    = collate->nrules * sizeof (u_int32_t);
   /* Another trick here.  Describing the collation method needs only a
      few bits (3, to be exact).  But the binary file should be
      accessible by maschines with both endianesses and so we store both
@@ -366,15 +366,16 @@ Computing table size for collation information might take a while..."),
     table[cnt] = collate->rules[cnt] | SWAPU32 (collate->rules[cnt]);
 
   iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_HASH_SIZE)].iov_base = &table_best;
-  iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_HASH_SIZE)].iov_len = sizeof (u32_t);
+  iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_HASH_SIZE)].iov_len = sizeof (u_int32_t);
 
   iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_HASH_LAYERS)].iov_base = &level_best;
-  iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_HASH_LAYERS)].iov_len = sizeof (u32_t);
+  iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_HASH_LAYERS)].iov_len
+    = sizeof (u_int32_t);
 
   entry_size = 1 + MAX (collate->nrules, 2);
 
-  table = (u32_t *) alloca (table_best * level_best * entry_size
-			    * sizeof (table[0]));
+  table = (u_int32_t *) alloca (table_best * level_best * entry_size
+				* sizeof (table[0]));
   memset (table, '\0', table_best * level_best * entry_size
 	  * sizeof (table[0]));
 
@@ -382,7 +383,7 @@ Computing table size for collation information might take a while..."),
   /* Macros for inserting in output table.  */
 #define ADD_VALUE(expr)							      \
   do {									      \
-    u32_t to_write = (u32_t) expr;					      \
+    u_int32_t to_write = (u_int32_t) expr;				      \
     obstack_grow (&non_simple, &to_write, sizeof (to_write));		      \
   } while (0)
 
@@ -393,7 +394,7 @@ Computing table size for collation information might take a while..."),
     ADD_VALUE (len);							      \
 									      \
     wlen = wcslen (pelem->name);					      \
-    obstack_grow (&non_simple, pelem->name, (wlen + 1) * sizeof (u32_t));     \
+    obstack_grow (&non_simple, pelem->name, (wlen + 1) * sizeof (u_int32_t)); \
 									      \
     idx = collate->nrules;						      \
     for (cnt = 0; cnt < collate->nrules; ++cnt)				      \
@@ -417,14 +418,14 @@ Computing table size for collation information might take a while..."),
     table[(level * table_best + slot) * entry_size + 1]			      \
       = FORWARD_CHAR;							      \
     table[(level * table_best + slot) * entry_size + 2]			      \
-      = obstack_object_size (&non_simple) / sizeof (u32_t);		      \
+      = obstack_object_size (&non_simple) / sizeof (u_int32_t);		      \
 									      \
     /* Here we have to construct the non-simple table entry.  First	      \
        compute the total length of this entry.  */			      \
     for (runp = (pelem); runp != NULL; runp = runp->next)		      \
       if (runp->ordering != NULL)					      \
 	{								      \
-	  u32_t value;							      \
+	  u_int32_t value;						      \
 	  size_t cnt;							      \
 									      \
 	  value = 1 + wcslen (runp->name) + 1;				      \
@@ -513,7 +514,7 @@ Computing table size for collation information might take a while..."),
       {
 	/* We have to fill in the information from the UNDEFINED
 	   entry.  */
-	table[cnt * entry_size] = (u32_t) cnt;
+	table[cnt * entry_size] = (u_int32_t) cnt;
 
 	if (collate->undefined.ordering_len == collate->nrules)
 	  {
@@ -593,18 +594,18 @@ Computing table size for collation information might take a while..."),
 
   /* Finish the extra block.  */
   extra_len = obstack_object_size (&non_simple);
-  extra = (u32_t *) obstack_finish (&non_simple);
-  assert ((extra_len % sizeof (u32_t)) == 0);
+  extra = (u_int32_t *) obstack_finish (&non_simple);
+  assert ((extra_len % sizeof (u_int32_t)) == 0);
 
   /* Now we have to build the two array for the other byte ordering.  */
-  table2 = (u32_t *) alloca (table_best * level_best * entry_size
-			     * sizeof (table[0]));
-  extra2 = (u32_t *) alloca (extra_len);
+  table2 = (u_int32_t *) alloca (table_best * level_best * entry_size
+				 * sizeof (table[0]));
+  extra2 = (u_int32_t *) alloca (extra_len);
 
   for (cnt = 0; cnt < table_best * level_best * entry_size; ++cnt)
     table2[cnt] = SWAPU32 (table[cnt]);
 
-  for (cnt = 0; cnt < extra_len / sizeof (u32_t); ++cnt)
+  for (cnt = 0; cnt < extra_len / sizeof (u_int32_t); ++cnt)
     extra2[cnt] = SWAPU32 (extra2[cnt]);
 
   /* Store table adresses and lengths.   */
@@ -639,7 +640,7 @@ Computing table size for collation information might take a while..."),
 #endif
 
   iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_UNDEFINED)].iov_base = &undefined_offset;
-  iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_UNDEFINED)].iov_len = sizeof (u32_t);
+  iov[2 + _NL_ITEM_INDEX (_NL_COLLATE_UNDEFINED)].iov_len = sizeof (u_int32_t);
 
   /* Update idx array.  */
   idx[0] = iov[0].iov_len + iov[1].iov_len;
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 99e9ebe3fa..79e01ba69b 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -59,9 +59,9 @@ void *xrealloc (void *__ptr, size_t __n);
 /* To be compatible with former implementations we for now restrict
    the number of bits for character classes to 16.  When compatibility
    is not necessary anymore increase the number to 32.  */
-#define char_class_t u16_t
+#define char_class_t u_int16_t
 #define CHAR_CLASS_TRANS SWAPU16
-#define char_class32_t u32_t
+#define char_class32_t u_int32_t
 #define CHAR_CLASS32_TRANS SWAPU32
 
 
@@ -72,13 +72,13 @@ struct locale_ctype_t
   size_t charnames_max;
   size_t charnames_act;
 
-  /* We will allow up to 8 * sizeof(u32_t) - 1 character classes.  */
-#define MAX_NR_CHARCLASS (8 * sizeof (u32_t) - 1)
+  /* We will allow up to 8 * sizeof(u_int32_t) - 1 character classes.  */
+#define MAX_NR_CHARCLASS (8 * sizeof (u_int32_t) - 1)
   int nr_charclass;
   const char *classnames[MAX_NR_CHARCLASS];
   unsigned long int current_class_mask;
   unsigned int last_class_char;
-  u32_t *class_collection;
+  u_int32_t *class_collection;
   size_t class_collection_max;
   size_t class_collection_act;
   unsigned long int class_done;
@@ -87,7 +87,7 @@ struct locale_ctype_t
      increase it.  But I doubt it will.  --drepper@gnu */
 #define MAX_NR_CHARMAP 16
   const char *mapnames[MAX_NR_CHARMAP];
-  u32_t *map_collection[MAX_NR_CHARMAP];
+  u_int32_t *map_collection[MAX_NR_CHARMAP];
   unsigned int map_collection_max[MAX_NR_CHARMAP];
   unsigned int map_collection_act[MAX_NR_CHARMAP];
   size_t map_collection_nr;
@@ -97,16 +97,16 @@ struct locale_ctype_t
   int tolower_done;
 
   /* The arrays for the binary representation.  */
-  u32_t plane_size;
-  u32_t plane_cnt;
+  u_int32_t plane_size;
+  u_int32_t plane_cnt;
   char_class_t *ctype_b;
   char_class32_t *ctype32_b;
-  u32_t *names_el;
-  u32_t *names_eb;
-  u32_t **map_eb;
-  u32_t **map_el;
-  u32_t *class_name_ptr;
-  u32_t *map_name_ptr;
+  u_int32_t *names_el;
+  u_int32_t *names_eb;
+  u_int32_t **map_eb;
+  u_int32_t **map_el;
+  u_int32_t *class_name_ptr;
+  u_int32_t *map_name_ptr;
   unsigned char *width;
 };
 
@@ -117,8 +117,8 @@ static void ctype_class_newP (struct linereader *lr,
 static void ctype_map_newP (struct linereader *lr,
 			    struct locale_ctype_t *ctype,
 			    const char *name, struct charset_t *charset);
-static u32_t *find_idx (struct locale_ctype_t *ctype, u32_t **table,
-			size_t *max, size_t *act, unsigned int idx);
+static u_int32_t *find_idx (struct locale_ctype_t *ctype, u_int32_t **table,
+			    size_t *max, size_t *act, unsigned int idx);
 static void set_class_defaults (struct locale_ctype_t *ctype,
 				struct charset_t *charset);
 static void allocate_arrays (struct locale_ctype_t *ctype,
@@ -167,8 +167,9 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale,
   ctype_class_newP (lr, ctype, "alnum");
 
   ctype->class_collection_max = charset->mb_cur_max == 1 ? 256 : 512;
-  ctype->class_collection = (u32_t *) xmalloc (sizeof (unsigned long int)
-					       * ctype->class_collection_max);
+  ctype->class_collection
+    = (u_int32_t *) xmalloc (sizeof (unsigned long int)
+			     * ctype->class_collection_max);
   memset (ctype->class_collection, '\0',
 	  sizeof (unsigned long int) * ctype->class_collection_max);
   ctype->class_collection_act = 256;
@@ -348,7 +349,7 @@ ctype_output (struct localedef_t *locale, struct charset_t *charset,
   struct iovec iov[2 + nelems + ctype->nr_charclass
 		  + ctype->map_collection_nr];
   struct locale_file data;
-  u32_t idx[nelems];
+  u_int32_t idx[nelems];
   size_t elem, cnt, offset, total;
 
 
@@ -397,20 +398,20 @@ ctype_output (struct localedef_t *locale, struct charset_t *charset,
 	  CTYPE_DATA (_NL_CTYPE_TOUPPER_EB,
 		      ctype->map_eb[0],
 		      (ctype->plane_size * ctype->plane_cnt + 128)
-		      * sizeof (u32_t));
+		      * sizeof (u_int32_t));
 	  CTYPE_DATA (_NL_CTYPE_TOLOWER_EB,
 		      ctype->map_eb[1],
 		      (ctype->plane_size * ctype->plane_cnt + 128)
-		      * sizeof (u32_t));
+		      * sizeof (u_int32_t));
 
 	  CTYPE_DATA (_NL_CTYPE_TOUPPER_EL,
 		      ctype->map_el[0],
 		      (ctype->plane_size * ctype->plane_cnt + 128)
-		      * sizeof (u32_t));
+		      * sizeof (u_int32_t));
 	  CTYPE_DATA (_NL_CTYPE_TOLOWER_EL,
 		      ctype->map_el[1],
 		      (ctype->plane_size * ctype->plane_cnt + 128)
-		      * sizeof (u32_t));
+		      * sizeof (u_int32_t));
 
 	  CTYPE_DATA (_NL_CTYPE_CLASS32,
 		      ctype->ctype32_b,
@@ -418,16 +419,16 @@ ctype_output (struct localedef_t *locale, struct charset_t *charset,
 		       * sizeof (char_class32_t)));
 
 	  CTYPE_DATA (_NL_CTYPE_NAMES_EB,
-		      ctype->names_eb,
-		      ctype->plane_size * ctype->plane_cnt * sizeof (u32_t));
+		      ctype->names_eb, (ctype->plane_size * ctype->plane_cnt
+					* sizeof (u_int32_t)));
 	  CTYPE_DATA (_NL_CTYPE_NAMES_EL,
-		      ctype->names_el,
-		      ctype->plane_size * ctype->plane_cnt * sizeof (u32_t));
+		      ctype->names_el, (ctype->plane_size * ctype->plane_cnt
+					* sizeof (u_int32_t)));
 
 	  CTYPE_DATA (_NL_CTYPE_HASH_SIZE,
-		      &ctype->plane_size, sizeof (u32_t));
+		      &ctype->plane_size, sizeof (u_int32_t));
 	  CTYPE_DATA (_NL_CTYPE_HASH_LAYERS,
-		      &ctype->plane_cnt, sizeof (u32_t));
+		      &ctype->plane_cnt, sizeof (u_int32_t));
 
 	  case _NL_ITEM_INDEX (_NL_CTYPE_CLASS_NAMES):
 	    /* The class name array.  */
@@ -485,7 +486,7 @@ ctype_output (struct localedef_t *locale, struct charset_t *charset,
 
 	  iov[2 + elem + offset].iov_len = ((ctype->plane_size
 					     * ctype->plane_cnt + 128)
-					    * sizeof (u32_t));
+					    * sizeof (u_int32_t));
 
 	  if (elem + 1 < nelems)
 	    idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
@@ -825,10 +826,10 @@ implementation limit: no more than %d character maps allowed"),
   else
     ctype->map_collection_max[cnt] = max_chars;
 
-  ctype->map_collection[cnt] =
-    (u32_t *) xmalloc (sizeof (u32_t) * ctype->map_collection_max[cnt]);
+  ctype->map_collection[cnt] = (u_int32_t *)
+    xmalloc (sizeof (u_int32_t) * ctype->map_collection_max[cnt]);
   memset (ctype->map_collection[cnt], '\0',
-	  sizeof (u32_t) * ctype->map_collection_max[cnt]);
+	  sizeof (u_int32_t) * ctype->map_collection_max[cnt]);
   ctype->map_collection_act[cnt] = 256;
 
   ++ctype->map_collection_nr;
@@ -837,8 +838,8 @@ implementation limit: no more than %d character maps allowed"),
 
 /* We have to be prepared that TABLE, MAX, and ACT can be NULL.  This
    is possible if we only want ot extend the name array.  */
-static u32_t *
-find_idx (struct locale_ctype_t *ctype, u32_t **table, size_t *max,
+static u_int32_t *
+find_idx (struct locale_ctype_t *ctype, u_int32_t **table, size_t *max,
 	  size_t *act, unsigned int idx)
 {
   size_t cnt;
@@ -878,8 +879,9 @@ find_idx (struct locale_ctype_t *ctype, u32_t **table, size_t *max,
 	  while (*max <= cnt);
 
 	  *table =
-	    (u32_t *) xrealloc (*table, *max * sizeof (unsigned long int));
-	  memset (&(*table)[old_max], '\0', (*max - old_max) * sizeof (u32_t));
+	    (u_int32_t *) xrealloc (*table, *max * sizeof (unsigned long int));
+	  memset (&(*table)[old_max], '\0',
+		  (*max - old_max) * sizeof (u_int32_t));
 	}
 
       (*table)[cnt] = 0;
@@ -1219,10 +1221,12 @@ Computing table size for character classes might take a while..."),
 # 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));
+  ctype->names_eb = (u_int32_t *) xcalloc (ctype->plane_size
+					   * ctype->plane_cnt,
+					   sizeof (u_int32_t));
+  ctype->names_el = (u_int32_t *) xcalloc (ctype->plane_size
+					   * ctype->plane_cnt,
+					   sizeof (u_int32_t));
 
   for (idx = 1; idx < 256; ++idx)
     NAMES_B1[idx] = idx;
@@ -1286,10 +1290,10 @@ Computing table size for character classes might take a while..."),
       = 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 *));
+  ctype->map_eb = (u_int32_t **) xmalloc (ctype->map_collection_nr
+					  * sizeof (u_int32_t *));
+  ctype->map_el = (u_int32_t **) xmalloc (ctype->map_collection_nr
+					  * sizeof (u_int32_t *));
 
   /* Fill in all mappings.  */
   for (idx = 0; idx < ctype->map_collection_nr; ++idx)
@@ -1297,12 +1301,12 @@ Computing table size for character classes might take a while..."),
       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));
+      ctype->map_eb[idx] = (u_int32_t *) xmalloc ((ctype->plane_size
+						   * ctype->plane_cnt + 128)
+						  * sizeof (u_int32_t));
+      ctype->map_el[idx] = (u_int32_t *) xmalloc ((ctype->plane_size
+						   * ctype->plane_cnt + 128)
+						  * sizeof (u_int32_t));
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 # define MAP_B1 ctype->map_el
@@ -1314,7 +1318,7 @@ Computing table size for character classes might take a while..."),
 
       /* Copy default value (identity mapping).  */
       memcpy (&MAP_B1[idx][128], NAMES_B1,
-	      ctype->plane_size * ctype->plane_cnt * sizeof (u32_t));
+	      ctype->plane_size * ctype->plane_cnt * sizeof (u_int32_t));
 
       /* Copy values from collection.  */
       for (idx2 = 0; idx2 < ctype->map_collection_act[idx]; ++idx2)
@@ -1336,10 +1340,10 @@ Computing table size for character classes might take a while..."),
     }
 
   /* 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));
+  ctype->class_name_ptr = (u_int32_t *) xmalloc (ctype->nr_charclass
+						 * sizeof (u_int32_t));
+  ctype->map_name_ptr = (u_int32_t *) xmalloc (ctype->map_collection_nr
+					       * sizeof (u_int32_t));
 
   /* Array for width information.  Because the expected width are very
      small we use only one single byte.  This save space and we need
diff --git a/locale/programs/ld-messages.c b/locale/programs/ld-messages.c
index ebd5054b02..ede616768d 100644
--- a/locale/programs/ld-messages.c
+++ b/locale/programs/ld-messages.c
@@ -128,7 +128,7 @@ messages_output (struct localedef_t *locale, const char *output_path)
     = locale->categories[LC_MESSAGES].messages;
   struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES)];
   struct locale_file data;
-  u32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES)];
+  u_int32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES)];
   size_t cnt = 0;
 
   if ((locale->binary & (1 << LC_MESSAGES)) != 0)
diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c
index 18e27866fb..a717377a8b 100644
--- a/locale/programs/ld-monetary.c
+++ b/locale/programs/ld-monetary.c
@@ -182,7 +182,7 @@ monetary_output (struct localedef_t *locale, const char *output_path)
     = locale->categories[LC_MONETARY].monetary;
   struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_MONETARY)];
   struct locale_file data;
-  u32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_MONETARY)];
+  u_int32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_MONETARY)];
   size_t cnt = 0;
 
   if ((locale->binary & (1 << LC_MONETARY)) != 0)
diff --git a/locale/programs/ld-numeric.c b/locale/programs/ld-numeric.c
index 0b5fe2afe5..dcee7bdb4e 100644
--- a/locale/programs/ld-numeric.c
+++ b/locale/programs/ld-numeric.c
@@ -102,7 +102,7 @@ numeric_output (struct localedef_t *locale, const char *output_path)
   struct locale_numeric_t *numeric = locale->categories[LC_NUMERIC].numeric;
   struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_NUMERIC)];
   struct locale_file data;
-  u32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_NUMERIC)];
+  u_int32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_NUMERIC)];
   size_t cnt = 0;
 
   if ((locale->binary & (1 << LC_NUMERIC)) != 0)
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index 2587faccdc..e031b24edc 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -117,7 +117,7 @@ time_output (struct localedef_t *locale, const char *output_path)
   struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_TIME)
 		  + time->cur_num_alt_digits];
   struct locale_file data;
-  u32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_TIME)];
+  u_int32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_TIME)];
   size_t cnt, last_idx, num;
 
   if ((locale->binary & (1 << LC_TIME)) != 0)
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index 72eb2d36e2..e9fb6d57a6 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -1,6 +1,6 @@
 /* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
-Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
 The GNU C Library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public License as
@@ -36,6 +36,7 @@ Boston, MA 02111-1307, USA.  */
 #include "error.h"
 #include "charset.h"
 #include "locfile.h"
+#include "../intl/loadinfo.h"
 
 /* Undefine the following line in the production version.  */
 /* #define NDEBUG 1 */
@@ -95,7 +96,7 @@ void *xmalloc (size_t __n);
 /* Prototypes for local functions.  */
 static void usage (int status) __attribute__ ((noreturn));
 static void error_print (void);
-static const char *construct_output_path (const char *path);
+static const char *construct_output_path (char *path);
 
 
 int
@@ -424,25 +425,50 @@ error_print ()
    contain a '/' character it is a relativ path.  Otherwise it names the
    locale this definition is for.  */
 static const char *
-construct_output_path (const char *path)
+construct_output_path (char *path)
 {
+  char *normal = NULL;
   char *result;
 
   if (strchr (path, '/') == NULL)
     {
-      /* This is a system path.  */
-      int path_max_len = pathconf (LOCALE_PATH, _PC_PATH_MAX) + 1;
-      result = (char *) xmalloc (path_max_len);
+      /* This is a system path.  First examine whether the locale name
+	 contains a reference to the codeset.  This should be
+	 normalized.  */
+      char *startp, *endp;
+
+      startp = path;
+      /* We must be prepared for finding a CEN name or a location of
+	 the introducing `.' where it is not possible anymore.  */
+      while (*startp != '\0' && *startp != '@' && *startp != '.'
+	     && *startp != '+' && *startp != ',')
+	++startp;
+      if (*startp == '.')
+	{
+	  /* We found a codeset specification.  Now find the end.  */
+	  endp = ++startp;
+	  while (*endp != '\0' && *endp != '@')
+	    ++endp;
+
+	  if (endp > startp)
+	    normal = _nl_normalize_codeset (startp, endp - startp);
+	}
 
-      snprintf (result, path_max_len, "%s/%s", LOCALE_PATH, path);
+      /* We put an additional '\0' at the end of the string because at
+	 the end of the function we need another byte for the trailing
+	 '/'.  */
+      if (normal == NULL)
+	asprintf (&result, "%s/%s\0", LOCALE_PATH, path);
+      else
+	asprintf (&result, "%s/%.*s%s%s\0", LOCALE_PATH, startp - path, path,
+		  normal, endp);
     }
   else
     {
-      char *t;
-      /* This is a user path.  */
+      /* This is a user path.  Please note the additional byte in the
+	 memory allocation.  */
       result = xmalloc (strlen (path) + 2);
-      t = stpcpy (result, path);
-      *t = '\0';
+      strcpy (result, path);
     }
 
   errno = 0;