2002-08-28 Roland McGrath <roland@redhat.com>
* locale/lc-time.c (_nl_init_era_entries, _nl_get_era_entry, _nl_select_era_entry): Moved to ... * time/era.c: ... here, new file. (_nl_init_era_entries, _nl_get_era_entry, _nl_select_era_entry): Add internal_function to definitions. Take an additional argument giving the `struct locale_data *' to use. * locale/lc-time.c (_get_alt_digit, _nl_get_walt_digit, _nl_parse_alt_digit): Moved to ... * time/alt_digit.c: ... here, new file. * time/lc-time-cleanup.c: New file. * locale/lc-time.c (_nl_postload_time, free_mem): Functions removed. * locale/localeinfo.h (_nl_postload_time): Remove decl. (_nl_cleanup_time): Declare it. (_nl_get_era_entry, _nl_select_era_entry): Update decls. (_get_alt_digit, _nl_get_walt_digit, _nl_parse_alt_digit): Likewise. * time/Makefile (aux): New variable: era, alt_digit, lc-time-cleanup. * time/strftime.c: Pass locale data to helper functions. * time/strptime.c: Likewise. * time/strptime.c [USE_IN_EXTENDED_LOCALE_MODEL] (_NL_CURRENT_WORD): Redefine this too.
This commit is contained in:
parent
dd4f211573
commit
6e68eecf7b
|
@ -105,7 +105,7 @@ localtime_r (t, tp)
|
||||||
\
|
\
|
||||||
if (*decided != raw) \
|
if (*decided != raw) \
|
||||||
{ \
|
{ \
|
||||||
val = _nl_parse_alt_digit (&rp); \
|
val = _nl_parse_alt_digit (&rp HELPER_LOCALE_ARG); \
|
||||||
if (val == -1 && *decided != loc) \
|
if (val == -1 && *decided != loc) \
|
||||||
{ \
|
{ \
|
||||||
*decided = loc; \
|
*decided = loc; \
|
||||||
|
@ -195,15 +195,24 @@ const unsigned short int __mon_yday[2][13] =
|
||||||
# undef _NL_CURRENT
|
# undef _NL_CURRENT
|
||||||
# define _NL_CURRENT(category, item) \
|
# define _NL_CURRENT(category, item) \
|
||||||
(current->values[_NL_ITEM_INDEX (item)].string)
|
(current->values[_NL_ITEM_INDEX (item)].string)
|
||||||
|
# undef _NL_CURRENT_WORD
|
||||||
|
# define _NL_CURRENT_WORD(category, item) \
|
||||||
|
(current->values[_NL_ITEM_INDEX (item)].word)
|
||||||
# define LOCALE_PARAM , locale
|
# define LOCALE_PARAM , locale
|
||||||
# define LOCALE_ARG , locale
|
# define LOCALE_ARG , locale
|
||||||
# define LOCALE_PARAM_PROTO , __locale_t locale
|
# define LOCALE_PARAM_PROTO , __locale_t locale
|
||||||
# define LOCALE_PARAM_DECL __locale_t locale;
|
# define LOCALE_PARAM_DECL __locale_t locale;
|
||||||
|
# define HELPER_LOCALE_ARG , current
|
||||||
#else
|
#else
|
||||||
# define LOCALE_PARAM
|
# define LOCALE_PARAM
|
||||||
# define LOCALE_ARG
|
# define LOCALE_ARG
|
||||||
# define LOCALE_PARAM_DECL
|
# define LOCALE_PARAM_DECL
|
||||||
# define LOCALE_PARAM_PROTO
|
# define LOCALE_PARAM_PROTO
|
||||||
|
# ifdef _LIBC
|
||||||
|
# define HELPER_LOCALE_ARG , _NL_CURRENT_DATA (LC_TIME)
|
||||||
|
# else
|
||||||
|
# define HELPER_LOCALE_ARG
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -731,8 +740,8 @@ strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
|
||||||
{
|
{
|
||||||
if (era_cnt >= 0)
|
if (era_cnt >= 0)
|
||||||
{
|
{
|
||||||
era = _nl_select_era_entry (era_cnt);
|
era = _nl_select_era_entry (era_cnt HELPER_LOCALE_ARG);
|
||||||
if (match_string (era->era_name, rp))
|
if (era != NULL && match_string (era->era_name, rp))
|
||||||
{
|
{
|
||||||
*decided = loc;
|
*decided = loc;
|
||||||
break;
|
break;
|
||||||
|
@ -747,8 +756,9 @@ strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
|
||||||
for (era_cnt = 0; era_cnt < (int) num_eras;
|
for (era_cnt = 0; era_cnt < (int) num_eras;
|
||||||
++era_cnt, rp = rp_backup)
|
++era_cnt, rp = rp_backup)
|
||||||
{
|
{
|
||||||
era = _nl_select_era_entry (era_cnt);
|
era = _nl_select_era_entry (era_cnt
|
||||||
if (match_string (era->era_name, rp))
|
HELPER_LOCALE_ARG);
|
||||||
|
if (era != NULL && match_string (era->era_name, rp))
|
||||||
{
|
{
|
||||||
*decided = loc;
|
*decided = loc;
|
||||||
break;
|
break;
|
||||||
|
@ -787,8 +797,8 @@ strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
|
||||||
for (era_cnt = 0; era_cnt < (int) num_eras;
|
for (era_cnt = 0; era_cnt < (int) num_eras;
|
||||||
++era_cnt, rp = rp_backup)
|
++era_cnt, rp = rp_backup)
|
||||||
{
|
{
|
||||||
era = _nl_select_era_entry (era_cnt);
|
era = _nl_select_era_entry (era_cnt HELPER_LOCALE_ARG);
|
||||||
if (recursive (era->era_format))
|
if (era != NULL && recursive (era->era_format))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (era_cnt == (int) num_eras)
|
if (era_cnt == (int) num_eras)
|
||||||
|
@ -971,7 +981,9 @@ strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
|
||||||
|
|
||||||
if (era_cnt != -1)
|
if (era_cnt != -1)
|
||||||
{
|
{
|
||||||
era = _nl_select_era_entry (era_cnt);
|
era = _nl_select_era_entry (era_cnt HELPER_LOCALE_ARG);
|
||||||
|
if (era == NULL)
|
||||||
|
return NULL;
|
||||||
if (want_era)
|
if (want_era)
|
||||||
tm->tm_year = (era->start_date[0]
|
tm->tm_year = (era->start_date[0]
|
||||||
+ ((tm->tm_year - era->offset)
|
+ ((tm->tm_year - era->offset)
|
||||||
|
|
Loading…
Reference in New Issue