[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commits] r23930 - in /trunk/libc: ./ locale/programs/



Author: joseph
Date: Thu Sep  5 23:38:37 2013
New Revision: 23930

Log:
	* locale/programs/3level.h, locale/programs/ld-collate.c,
	locale/programs/ld-ctype.c, locale/programs/locarchive.c,
	locale/programs/locfile.c, locale/programs/locfile.h: Revert
	spurious differences from glibc, fix coding standards and
	otherwise align with
	<https://sourceware.org/ml/libc-alpha/2013-09/msg00148.html>.

Modified:
    trunk/libc/ChangeLog.eglibc
    trunk/libc/locale/programs/3level.h
    trunk/libc/locale/programs/ld-collate.c
    trunk/libc/locale/programs/ld-ctype.c
    trunk/libc/locale/programs/locarchive.c
    trunk/libc/locale/programs/locfile.c
    trunk/libc/locale/programs/locfile.h

Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Thu Sep  5 23:38:37 2013
@@ -1,3 +1,12 @@
+2013-09-05  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* locale/programs/3level.h, locale/programs/ld-collate.c,
+	locale/programs/ld-ctype.c, locale/programs/locarchive.c,
+	locale/programs/locfile.c, locale/programs/locfile.h: Revert
+	spurious differences from glibc, fix coding standards and
+	otherwise align with
+	<https://sourceware.org/ml/libc-alpha/2013-09/msg00148.html>.
+
 2013-08-29  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* Makerules, elf/Makefile, elf/do-rel.h, extra-lib.mk,

Modified: trunk/libc/locale/programs/3level.h
==============================================================================
--- trunk/libc/locale/programs/3level.h (original)
+++ trunk/libc/locale/programs/3level.h Thu Sep  5 23:38:37 2013
@@ -26,7 +26,8 @@
      ELEMENT      to the type of every entry
      DEFAULT      to the default value for empty entries
      ITERATE      if you want the TABLE_iterate function to be defined
-     NO_FINALIZE  if you don't want the TABLE_finalize function to be defined
+     NO_ADD_LOCALE  if you don't want the add_locale_TABLE function
+		    to be defined
 
    This will define
 
@@ -36,7 +37,7 @@
      void TABLE_add (struct TABLE *t, uint32_t wc, ELEMENT value);
      void TABLE_iterate (struct TABLE *t,
 			 void (*fn) (uint32_t wc, ELEMENT value));
-     void TABLE_finalize (struct TABLE *t);
+     void add_locale_TABLE (struct locale_file *file, struct TABLE *t);
 */
 
 #define CONCAT(a,b) CONCAT1(a,b)
@@ -57,6 +58,7 @@
   size_t level3_alloc;
   size_t level3_size;
   ELEMENT *level3;
+  /* Size of compressed representation.  */
   size_t result_size;
 };
 
@@ -204,7 +206,7 @@
 }
 #endif
 
-#ifndef NO_FINALIZE
+#ifndef NO_ADD_LOCALE
 /* Finalize and shrink.  */
 static void
 CONCAT(add_locale_,TABLE) (struct locale_file *file, struct TABLE *t)
@@ -212,7 +214,7 @@
   size_t i, j, k;
   uint32_t reorder3[t->level3_size];
   uint32_t reorder2[t->level2_size];
-  uint32_t level1_offset, level2_offset, level3_offset, last_offset;
+  uint32_t level2_offset, level3_offset, last_offset;
 
   /* Uniquify level3 blocks.  */
   k = 0;
@@ -262,6 +264,7 @@
     if (t->level1[i] != EMPTY)
       t->level1[i] = reorder2[t->level1[i]];
 
+  /* Create and fill the resulting compressed representation.  */
   last_offset =
     5 * sizeof (uint32_t)
     + t->level1_size * sizeof (uint32_t)
@@ -269,8 +272,6 @@
     + (t->level3_size << t->p) * sizeof (ELEMENT);
   t->result_size = (last_offset + 3) & ~3ul;
 
-  level1_offset =
-    5 * sizeof (uint32_t);
   level2_offset =
     5 * sizeof (uint32_t)
     + t->level1_size * sizeof (uint32_t);
@@ -305,6 +306,8 @@
   else if (sizeof (ELEMENT) == sizeof (uint32_t))
     add_locale_uint32_array (file, (uint32_t *) t->level3,
 			     t->level3_size << t->p);
+  else
+    abort ();
   align_locale_data (file, 4);
   end_locale_structure (file);
 
@@ -322,4 +325,4 @@
 #undef ELEMENT
 #undef DEFAULT
 #undef ITERATE
-#undef NO_FINALIZE
+#undef NO_ADD_LOCALE

Modified: trunk/libc/locale/programs/ld-collate.c
==============================================================================
--- trunk/libc/locale/programs/ld-collate.c (original)
+++ trunk/libc/locale/programs/ld-collate.c Thu Sep  5 23:38:37 2013
@@ -169,7 +169,7 @@
 #define ELEMENT struct element_t *
 #define DEFAULT NULL
 #define ITERATE
-#define NO_FINALIZE
+#define NO_ADD_LOCALE
 #include "3level.h"
 
 /* Sparse table of int32_t.  */
@@ -1194,7 +1194,6 @@
 		{
 		  struct element_t *elem;
 		  size_t namelen;
-		  void *ptr;
 
 		  /* I don't think this can ever happen.  */
 		  assert (seq->name != NULL);
@@ -1207,6 +1206,7 @@
 		  /* Now we are ready to insert the new value in the
 		     sequence.  Find out whether the element is
 		     already known.  */
+		  void *ptr;
 		  if (find_entry (&collate->seq_table, seq->name, namelen,
 				  &ptr) != 0)
 		    {
@@ -1360,13 +1360,13 @@
 	      struct charseq *seq;
 	      uint32_t wc;
 	      int cnt;
-	      void *ptr;
 
 	      /* Generate the name.  */
 	      sprintf (buf + preflen, base == 10 ? "%0*ld" : "%0*lX",
 		       (int) (lenfrom - preflen), from);
 
 	      /* Look whether this name is already defined.  */
+	      void *ptr;
 	      if (find_entry (&collate->seq_table, buf, symlen, &ptr) == 0)
 		{
 		  /* Copy back the result.  */
@@ -2340,7 +2340,7 @@
     obstack_1grow (&weightpool, 0);
 
   /* Now add the four tables.  */
-  add_locale_uint32_array (&file, tablemb, 256);
+  add_locale_uint32_array (&file, (const uint32_t *) tablemb, 256);
   add_locale_raw_obstack (&file, &weightpool);
   add_locale_raw_obstack (&file, &extrapool);
   add_locale_raw_obstack (&file, &indirectpool);

Modified: trunk/libc/locale/programs/ld-ctype.c
==============================================================================
--- trunk/libc/locale/programs/ld-ctype.c (original)
+++ trunk/libc/locale/programs/ld-ctype.c Thu Sep  5 23:38:37 2013
@@ -119,7 +119,7 @@
 #define TABLE idx_table
 #define ELEMENT uint32_t
 #define DEFAULT ((uint32_t) ~0)
-#define NO_FINALIZE
+#define NO_ADD_LOCALE
 #include "3level.h"
 
 #define TABLE wcwidth_table
@@ -3542,7 +3542,7 @@
   size_t i, j, k;
   uint32_t reorder3[t->level3_size];
   uint32_t reorder2[t->level2_size];
-  uint32_t level1_offset, level2_offset, level3_offset;
+  uint32_t level2_offset, level3_offset;
 
   /* Uniquify level3 blocks.  */
   k = 0;
@@ -3598,8 +3598,6 @@
     + (t->level2_size << t->q) * sizeof (uint32_t)
     + (t->level3_size << t->p) * sizeof (uint32_t);
 
-  level1_offset =
-    5 * sizeof (uint32_t);
   level2_offset =
     5 * sizeof (uint32_t)
     + t->level1_size * sizeof (uint32_t);

Modified: trunk/libc/locale/programs/locarchive.c
==============================================================================
--- trunk/libc/locale/programs/locarchive.c (original)
+++ trunk/libc/locale/programs/locarchive.c Thu Sep  5 23:38:37 2013
@@ -326,7 +326,6 @@
   unsigned int cnt, loccnt;
   struct namehashent *oldnamehashtab;
   struct locarhandle new_ah;
-  struct oldlocrecent *oldlocrecarray;
   size_t prefix_len = output_prefix ? strlen (output_prefix) : 0;
   char archivefname[prefix_len + sizeof (ARCHIVE_NAME)];
   char fname[prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1];
@@ -457,7 +456,7 @@
 					   + head->namehash_offset);
 
   /* Sort the old locrec table in order of data position.  */
-  oldlocrecarray = alloca (sizeof (*oldlocrecarray) * head->namehash_size);
+  struct oldlocrecent oldlocrecarray[head->namehash_size];
   for (cnt = 0, loccnt = 0; cnt < head->namehash_size; ++cnt)
     if (oldnamehashtab[cnt].locrec_offset != 0)
       {
@@ -1129,9 +1128,9 @@
 	unsigned int nstrings;
 	unsigned int strindex[0];
       } *filedata = data[LC_CTYPE].addr;
-      char *normalized_codeset_name = NULL;
       codeset = (char *) filedata
 	+ filedata->strindex[_NL_ITEM_INDEX (_NL_CTYPE_CODESET_NAME)];
+      char *normalized_codeset_name = NULL;
 
       normalized_codeset = _nl_normalize_codeset (codeset, strlen (codeset));
       mask |= XPG_NORM_CODESET;

Modified: trunk/libc/locale/programs/locfile.c
==============================================================================
--- trunk/libc/locale/programs/locfile.c (original)
+++ trunk/libc/locale/programs/locfile.c Thu Sep  5 23:38:37 2013
@@ -656,8 +656,8 @@
 }
 
 /* Start building an element that contains several different pieces of data.
-   Subsequent calls to add_locale_*() will add data to the same element up
-   till the next call to end_locale_structure().  The element's alignment
+   Subsequent calls to add_locale_* will add data to the same element up
+   till the next call to end_locale_structure.  The element's alignment
    is dictated by the first piece of data added to it.  */
 void
 start_locale_structure (struct locale_file *file)
@@ -666,8 +666,8 @@
   file->structure_stage = 1;
 }
 
-/* Finish a structure element that was started by start_locale_structure().
-   Empty structures are OK and behave like add_locale_empty().  */
+/* Finish a structure element that was started by start_locale_structure.
+   Empty structures are OK and behave like add_locale_empty.  */
 void
 end_locale_structure (struct locale_file *file)
 {
@@ -677,9 +677,9 @@
 }
 
 /* Start building data that goes before the next element's recorded offset.
-   Subsequent calls to add_locale_*() will add data to the file without
+   Subsequent calls to add_locale_* will add data to the file without
    treating any of it as the start of a new element.  Calling
-   end_locale_prelude() switches back to the usual behavior.  */
+   end_locale_prelude switches back to the usual behavior.  */
 void
 start_locale_prelude (struct locale_file *file)
 {
@@ -687,7 +687,7 @@
   file->structure_stage = 3;
 }
 
-/* End a block started by start_locale_prelude().  */
+/* End a block started by start_locale_prelude.  */
 void
 end_locale_prelude (struct locale_file *file)
 {

Modified: trunk/libc/locale/programs/locfile.h
==============================================================================
--- trunk/libc/locale/programs/locfile.h (original)
+++ trunk/libc/locale/programs/locfile.h Thu Sep  5 23:38:37 2013
@@ -26,7 +26,8 @@
 #include "localedef.h"
 
 /* Structure for storing the contents of a category file.  */
-struct locale_file {
+struct locale_file
+{
   size_t n_elements, next_element;
   uint32_t *offsets;
   struct obstack data;
@@ -135,6 +136,7 @@
 extern void write_locale_data (const char *output_path, int catidx,
 			       const char *category, struct locale_file *file);
 
+
 /* Entrypoints for the parsers of the individual categories.  */
 
 /* Handle LC_CTYPE category.  */

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits