This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix some types in localedef


This patch makes a couple of miscellaneous fixes to types in
localedef.  The forward declaration of find_idx uses unsigned int
where the definition uses uint32_t, and unsigned int is also used in
allocating the ctype->charnames array when the relevant structure
field has type uint32_t *.  The patch makes both places use uint32_t
for consistency rather than embodying an assumption that unsigned int
must always be the same as uint32_t.

Tested x86_64 and committed as obvious.

2013-09-13  Richard Sandiford  <richard@codesourcery.com>

	* locale/programs/ld-ctype.c (find_idx): Use uint32_t in
	prototype.
	(ctype_startup): Use uint32_t in cast and sizeof for
	ctype->charnames.

diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 3903ee0..1696294 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -270,7 +270,7 @@ static void ctype_map_new (struct linereader *lr,
 			   struct locale_ctype_t *ctype,
 			   const char *name, const struct charmap_t *charmap);
 static uint32_t *find_idx (struct locale_ctype_t *ctype, uint32_t **table,
-			   size_t *max, size_t *act, unsigned int idx);
+			   size_t *max, size_t *act, uint32_t idx);
 static void set_class_defaults (struct locale_ctype_t *ctype,
 				const struct charmap_t *charmap,
 				struct repertoire_t *repertoire);
@@ -311,9 +311,8 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale,
 
 	  /* We have seen no names yet.  */
 	  ctype->charnames_max = charmap->mb_cur_max == 1 ? 256 : 512;
-	  ctype->charnames =
-	    (unsigned int *) xmalloc (ctype->charnames_max
-				      * sizeof (unsigned int));
+	  ctype->charnames = (uint32_t *) xmalloc (ctype->charnames_max
+						   * sizeof (uint32_t));
 	  for (cnt = 0; cnt < 256; ++cnt)
 	    ctype->charnames[cnt] = cnt;
 	  ctype->charnames_act = 256;

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]