diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2013-09-05 23:38:37 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2013-09-05 23:38:37 +0000 |
commit | a977505d8d09aa864a06433dac8bcb3ff92a30fe (patch) | |
tree | 4a5b9335aac98a47a54d05aef5f230cb34cc78f1 | |
parent | 2c1d357a5fe5bdc4c9521a9d1af05ba1b5a4c238 (diff) |
* 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>.
git-svn-id: svn://svn.eglibc.org/trunk@23930 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r-- | libc/ChangeLog.eglibc | 9 | ||||
-rw-r--r-- | libc/locale/programs/3level.h | 17 | ||||
-rw-r--r-- | libc/locale/programs/ld-collate.c | 8 | ||||
-rw-r--r-- | libc/locale/programs/ld-ctype.c | 6 | ||||
-rw-r--r-- | libc/locale/programs/locarchive.c | 5 | ||||
-rw-r--r-- | libc/locale/programs/locfile.c | 14 | ||||
-rw-r--r-- | libc/locale/programs/locfile.h | 4 |
7 files changed, 37 insertions, 26 deletions
diff --git a/libc/ChangeLog.eglibc b/libc/ChangeLog.eglibc index 436650bf8..b38e43d03 100644 --- a/libc/ChangeLog.eglibc +++ b/libc/ChangeLog.eglibc @@ -1,3 +1,12 @@ +2013-09-05 Joseph Myers <joseph@codesourcery.com> + + * 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@codesourcery.com> * Makerules, elf/Makefile, elf/do-rel.h, extra-lib.mk, diff --git a/libc/locale/programs/3level.h b/libc/locale/programs/3level.h index 419c3fd6e..b8d6ca023 100644 --- a/libc/locale/programs/3level.h +++ b/libc/locale/programs/3level.h @@ -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 @@ struct TABLE size_t level3_alloc; size_t level3_size; ELEMENT *level3; + /* Size of compressed representation. */ size_t result_size; }; @@ -204,7 +206,7 @@ CONCAT(TABLE,_iterate) (struct TABLE *t, } #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 @@ CONCAT(add_locale_,TABLE) (struct locale_file *file, struct TABLE *t) 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 @@ CONCAT(add_locale_,TABLE) (struct locale_file *file, struct TABLE *t) 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 @@ CONCAT(add_locale_,TABLE) (struct locale_file *file, struct TABLE *t) + (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 @@ CONCAT(add_locale_,TABLE) (struct locale_file *file, struct TABLE *t) 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 @@ CONCAT(add_locale_,TABLE) (struct locale_file *file, struct TABLE *t) #undef ELEMENT #undef DEFAULT #undef ITERATE -#undef NO_FINALIZE +#undef NO_ADD_LOCALE diff --git a/libc/locale/programs/ld-collate.c b/libc/locale/programs/ld-collate.c index df7867d0f..04f6e22cd 100644 --- a/libc/locale/programs/ld-collate.c +++ b/libc/locale/programs/ld-collate.c @@ -169,7 +169,7 @@ struct symbol_t #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 @@ range is not lower than that of the last character"), "LC_COLLATE"); { 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 @@ range is not lower than that of the last character"), "LC_COLLATE"); /* 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 @@ order for `%.*s' already defined at %s:%Zu"), 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 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap, 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); diff --git a/libc/locale/programs/ld-ctype.c b/libc/locale/programs/ld-ctype.c index e37a35e95..cbedc78d8 100644 --- a/libc/locale/programs/ld-ctype.c +++ b/libc/locale/programs/ld-ctype.c @@ -119,7 +119,7 @@ struct translit_include_t #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 @@ add_locale_wctype_table (struct locale_file *file, struct wctype_table *t) 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 @@ add_locale_wctype_table (struct locale_file *file, struct wctype_table *t) + (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); diff --git a/libc/locale/programs/locarchive.c b/libc/locale/programs/locarchive.c index 4e3bbfec9..d8df39a8e 100644 --- a/libc/locale/programs/locarchive.c +++ b/libc/locale/programs/locarchive.c @@ -326,7 +326,6 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) 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 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) + 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 @@ add_locale_to_archive (ah, name, data, replace) 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; diff --git a/libc/locale/programs/locfile.c b/libc/locale/programs/locfile.c index 80d0f7735..c91e996f9 100644 --- a/libc/locale/programs/locfile.c +++ b/libc/locale/programs/locfile.c @@ -656,8 +656,8 @@ add_locale_char (struct locale_file *file, char value) } /* 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 @@ start_locale_structure (struct locale_file *file) 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 @@ end_locale_structure (struct locale_file *file) } /* 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 @@ start_locale_prelude (struct locale_file *file) 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) { diff --git a/libc/locale/programs/locfile.h b/libc/locale/programs/locfile.h index f20122fa4..372bbd402 100644 --- a/libc/locale/programs/locfile.h +++ b/libc/locale/programs/locfile.h @@ -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 end_locale_prelude (struct locale_file *file); 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. */ |