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] | |
On 21 Mar 2016 10:10, Rafal Luzynski wrote:
> Otherwise if the last element of a category is an array (stringarray,
> wstringarray etc.) this array will count only the first element
> of the array element and will not load a category, will complain
> that a locale file is too long.
sorry, but i'm not seeing the problem here. the type field is merely
an enum. whether the last element is a stringarray (value of 2) or a
byte (value of 3), the array will still build up the same # of elements.
the _nl_value_type_LC_xxx array is indexing the _NL_xxx field only, not
the contents of it.
> --- a/locale/loadlocale.c
> +++ b/locale/loadlocale.c
> @@ -45,7 +45,8 @@ static const size_t _nl_category_num_items[] =
> #define NO_PAREN(arg, rest...) arg, ##rest
>
> #define DEFINE_CATEGORY(category, category_name, items, a) \
> -static const enum value_type _nl_value_type_##category[] = { NO_PAREN items };
> +static const enum value_type _nl_value_type_##category \
> + [_NL_ITEM_INDEX (_NL_NUM_##category)] = { NO_PAREN items };
> #define DEFINE_ELEMENT(element, element_name, optstd, type, rest...) \
> [_NL_ITEM_INDEX (element)] = type,
> #include "categories.def"
the code today will do for LC_IDENTIFICATION:
static const enum value_type _nl_value_type_LC_IDENTIFICATION[] = {
[((int) (_NL_IDENTIFICATION_TITLE) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_SOURCE) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_ADDRESS) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_CONTACT) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_EMAIL) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_TEL) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_FAX) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_LANGUAGE) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_TERRITORY) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_AUDIENCE) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_APPLICATION) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_ABBREVIATION) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_REVISION) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_DATE) & 0xffff)] = string,
[((int) (_NL_IDENTIFICATION_CATEGORY) & 0xffff)] = stringarray,
[((int) (_NL_IDENTIFICATION_CODESET) & 0xffff)] = string,
};
these NL values are defined in langinfo.h and expand as:
_NL_IDENTIFICATION_TITLE = (((12) << 16) | (0)),
_NL_IDENTIFICATION_SOURCE,
_NL_IDENTIFICATION_ADDRESS,
_NL_IDENTIFICATION_CONTACT,
_NL_IDENTIFICATION_EMAIL,
_NL_IDENTIFICATION_TEL,
_NL_IDENTIFICATION_FAX,
_NL_IDENTIFICATION_LANGUAGE,
_NL_IDENTIFICATION_TERRITORY,
_NL_IDENTIFICATION_AUDIENCE,
_NL_IDENTIFICATION_APPLICATION,
_NL_IDENTIFICATION_ABBREVIATION,
_NL_IDENTIFICATION_REVISION,
_NL_IDENTIFICATION_DATE,
_NL_IDENTIFICATION_CATEGORY,
_NL_IDENTIFICATION_CODESET,
_NL_NUM_LC_IDENTIFICATION,
_NL_IDENTIFICATION_CODESET is merely one larger than the
_NL_IDENTIFICATION_CATEGORY value. if CODESET didn't exist,
then CATEGORY (a stringarray) would be at the end, but the
array would still be defined/calculated correctly.
-mike
Attachment:
signature.asc
Description: Digital signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |