Mercurial > gnulib
changeset 39225:a188a4c517c4
Merge strftime.c changes from glibc
This incorporates:
2017-11-14 [BZ #10871] Implement alternative month names
2017-11-14 [BZ #10871] Abbreviated alternative month names (%Ob)
2017-06-20 Use locale_t, not __locale_t, throughout glibc
* lib/nstrftime.c (ABALTMON_1) [!COMPILE_WIDE]: New macro.
(LOCALE_PARAM) [_LIBC && USE_IN_EXTENDED_LOCALE_MODEL]:
Use locale_t, not __locale_t.
(a_altmonth, f_altmonth, aam_len) [_NL_CURRENT]: New macros.
(__strftime_internal): Add support for alternate months.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 23 Jan 2018 00:42:04 -0800 |
parents | d2880a59020a |
children | c67645792a3d |
files | ChangeLog lib/nstrftime.c |
diffstat | 2 files changed, 32 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Jan 23 09:15:49 2018 +0100 +++ b/ChangeLog Tue Jan 23 00:42:04 2018 -0800 @@ -1,3 +1,16 @@ +2018-01-23 Paul Eggert <eggert@cs.ucla.edu> + + Merge strftime.c changes from glibc + This incorporates: + 2017-11-14 [BZ #10871] Implement alternative month names + 2017-11-14 [BZ #10871] Abbreviated alternative month names (%Ob) + 2017-06-20 Use locale_t, not __locale_t, throughout glibc + * lib/nstrftime.c (ABALTMON_1) [!COMPILE_WIDE]: New macro. + (LOCALE_PARAM) [_LIBC && USE_IN_EXTENDED_LOCALE_MODEL]: + Use locale_t, not __locale_t. + (a_altmonth, f_altmonth, aam_len) [_NL_CURRENT]: New macros. + (__strftime_internal): Add support for alternate months. + 2018-01-23 Bruno Haible <bruno@clisp.org> doc: Mention another prerequisite for using Gnulib.
--- a/lib/nstrftime.c Tue Jan 23 09:15:49 2018 +0100 +++ b/lib/nstrftime.c Tue Jan 23 00:42:04 2018 -0800 @@ -91,6 +91,7 @@ # define UCHAR_T unsigned char # define L_(Str) Str # define NLW(Sym) Sym +# define ABALTMON_1 _NL_ABALTMON_1 # define MEMCPY(d, s, n) memcpy (d, s, n) # define STRLEN(s) strlen (s) @@ -255,7 +256,7 @@ # undef _NL_CURRENT # define _NL_CURRENT(category, item) \ (current->values[_NL_ITEM_INDEX (item)].string) -# define LOCALE_PARAM , __locale_t loc +# define LOCALE_PARAM , locale_t loc # define LOCALE_ARG , loc # define HELPER_LOCALE_ARG , current #else @@ -475,12 +476,19 @@ # define f_month \ ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \ ? "?" : _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon))) +# define a_altmonth \ + ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \ + ? "?" : _NL_CURRENT (LC_TIME, NLW(ABALTMON_1) + tp->tm_mon))) +# define f_altmonth \ + ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \ + ? "?" : _NL_CURRENT (LC_TIME, NLW(ALTMON_1) + tp->tm_mon))) # define ampm \ ((const CHAR_T *) _NL_CURRENT (LC_TIME, tp->tm_hour > 11 \ ? NLW(PM_STR) : NLW(AM_STR))) # define aw_len STRLEN (a_wkday) # define am_len STRLEN (a_month) +# define aam_len STRLEN (a_altmonth) # define ap_len STRLEN (ampm) #endif #if HAVE_TZNAME @@ -808,17 +816,20 @@ to_uppcase = true; to_lowcase = false; } - if (modifier != 0) + if (modifier == L_('E')) goto bad_format; #ifdef _NL_CURRENT - cpy (am_len, a_month); + if (modifier == L_('O')) + cpy (aam_len, a_altmonth); + else + cpy (am_len, a_month); break; #else goto underlying_strftime; #endif case L_('B'): - if (modifier != 0) + if (modifier == L_('E')) goto bad_format; if (change_case) { @@ -826,7 +837,10 @@ to_lowcase = false; } #ifdef _NL_CURRENT - cpy (STRLEN (f_month), f_month); + if (modifier == L_('O')) + cpy (STRLEN (f_altmonth), f_altmonth); + else + cpy (STRLEN (f_month), f_month); break; #else goto underlying_strftime;