diff options
author | richard <richard@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2006-09-07 17:03:10 +0000 |
---|---|---|
committer | richard <richard@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2006-09-07 17:03:10 +0000 |
commit | fb2c20d15ab8ca32b0c380b4968b07596bc09574 (patch) | |
tree | e12444341677b0448deeccd5c9661bebe5b37ee4 /libc/locale/programs/ld-messages.c | |
parent | 2a1a719fce3510662e1be71118db4e22136debe0 (diff) |
* locale/programs/3level.h (TABLE): Remove "result" field.
(TABLE,_finalize): Replace with...
(add_locale_,TABLE): ...this new function. Add data directly to a
locale_file instead of building up a result block.
* locale/programs/ld-address.c (address_output): Use the new
locale_file interface.
* locale/programs/ld-collate.c (obstack_int32_grow)
(obstack_int32_grow_fast): Pass the value through maybe_swap_uint32.
(collate_finish): Don't call collseq_table_finalize.
(output_weightwc): Use maybe_swap_uint32_obstack to reorder the
weights array.
(collate_output): Likewise the wide collation string. Don't call
collidx_table_finalize. Use the new locale_file interface.
* locale/programs/ld-ctype.c (wcwidth_table, wctrans_table)
(wctrans_table_add): Move definitions.
(wctype_table): Likewise. Remove "result" field.
(locale_ctype_t): Make "class_3level" an array of wctype_tables,
"map_3level" an array of wctrans_tables and "width" a wcwidth_table.
(ctype_output): Hoist the setting of default_missing_len and reuse it
in the DEFAULT_MISSING case. Use the new locale_file interface.
(wctype_finalize): Replace with...
(add_locale_wctype_table): ...this new function. Alter as for
add_locale_TABLE above.
(allocate_arrays): Adjust for new types of locale_ctype_t fields.
Don't call wctype_table_finalize, wctrans_table_finalize or
wcwidth_table_finalize.
* locale/programs/ld-identification.c (identification_output): Use
the new locale_file interface.
* locale/programs/ld-measurement.c (measurement_output): Likewise.
* locale/programs/ld-messages.c (messages_output): Likewise.
* locale/programs/ld-monetary.c (monetary_output): Likewise.
* locale/programs/ld-name.c (name_output): Likewise.
* locale/programs/ld-numeric.c (numeric_output): Likewise.
* locale/programs/ld-paper.c (paper_output): Likewise.
* locale/programs/ld-telephone.c (telephone_output): Likewise.
* locale/programs/ld-time.c (time_output): Likewise.
* locale/programs/localedef.c (OPT_LITTLE_ENDIAN): Define.
(OPT_BIG_ENDIAN): Define.
(options): Add --big-endian and --little-endian.
(parse_opt): Handle them.
* locale/programs/locfile.c: Include assert.h, wchar.h and
localeinfo.h.
(obstack_chunk_alloc, obstack_chunk_free): Define.
(swap_endianness_p, record_offset, init_locale_data, align_locale_data)
(add_locale_empty, add_locale_raw_data, add_locale_raw_obstack)
(add_locale_string, add_locale_wstring, add_locale_uint32)
(add_locale_uint32_array, add_locale_char, start_locale_structure)
(end_locale_structure, start_locale_prelude, end_locale_prelude): New.
(write_locale_data): Replace iovec arguments with a locale_file.
Build three iovecs internally, one for the header, one for the offsets
array and one for the data itself.
* locale/programs/locfile.h: Include obstack.h.
(locale_file): Redefine as a file-building structure.
(swap_endianness_p): Declare.
(set_big_endian, swap_uint32, maybe_swap_uint32)
(maybe_swap_uint32_array, maybe_swap_uint32_obstack): New functions.
(init_locale_data, align_locale_data, add_locale_empty)
(add_locale_raw_data, add_locale_raw_obstack, add_locale_string)
(add_locale_wstring, add_locale_uint32, add_locale_uint32_array)
(add_locale_char, start_locale_structure, end_locale_structure)
(start_locale_prelude, end_locale_prelude): Declare.
(write_locale_data): Adjust prototype as for locfile.c change.
git-svn-id: svn://svn.eglibc.org/trunk@164 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/locale/programs/ld-messages.c')
-rw-r--r-- | libc/locale/programs/ld-messages.c | 52 |
1 files changed, 9 insertions, 43 deletions
diff --git a/libc/locale/programs/ld-messages.c b/libc/locale/programs/ld-messages.c index e98574f13..66ac7e3d1 100644 --- a/libc/locale/programs/ld-messages.c +++ b/libc/locale/programs/ld-messages.c @@ -183,49 +183,15 @@ messages_output (struct localedef_t *locale, const struct charmap_t *charmap, { struct locale_messages_t *messages = locale->categories[LC_MESSAGES].messages; - struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES)]; - struct locale_file data; - uint32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES)]; - size_t cnt = 0; - - data.magic = LIMAGIC (LC_MESSAGES); - data.n = _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES); - iov[cnt].iov_base = (void *) &data; - iov[cnt].iov_len = sizeof (data); - ++cnt; - - iov[cnt].iov_base = (void *) idx; - iov[cnt].iov_len = sizeof (idx); - ++cnt; - - idx[cnt - 2] = iov[0].iov_len + iov[1].iov_len; - iov[cnt].iov_base = (char *) messages->yesexpr; - iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1; - ++cnt; - - idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len; - iov[cnt].iov_base = (char *) messages->noexpr; - iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1; - ++cnt; - - idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len; - iov[cnt].iov_base = (char *) messages->yesstr; - iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1; - ++cnt; - - idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len; - iov[cnt].iov_base = (char *) messages->nostr; - iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1; - ++cnt; - - idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len; - iov[cnt].iov_base = (char *) charmap->code_set_name; - iov[cnt].iov_len = strlen (iov[cnt].iov_base) + 1; - - assert (cnt + 1 == 2 + _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES)); - - write_locale_data (output_path, LC_MESSAGES, "LC_MESSAGES", - 2 + _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES), iov); + struct locale_file file; + + init_locale_data (&file, _NL_ITEM_INDEX (_NL_NUM_LC_MESSAGES)); + add_locale_string (&file, messages->yesexpr); + add_locale_string (&file, messages->noexpr); + add_locale_string (&file, messages->yesstr); + add_locale_string (&file, messages->nostr); + add_locale_string (&file, charmap->code_set_name); + write_locale_data (output_path, LC_MESSAGES, "LC_MESSAGES", &file); } |