From: Paul Eggert Date: Sat, 18 Dec 2021 19:39:17 +0000 (-0800) Subject: nstrftime: simplify by using libc-config.h. X-Git-Tag: v1.0~2510 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=2eaf224aca7259e77aed9f78f3c4c7fa12c21da1;p=gnulib.git nstrftime: simplify by using libc-config.h. * lib/nstrftime.c [!_LIBC]: Include libc-config.h instead of config.h. (iso_week_days): Simplify via libc-config.h’s __inline. (my_strftime): Simplify via libc-config.h’s libc_hidden_def. * modules/nstrftime (Depends-on): Add libc-config. --- diff --git a/ChangeLog b/ChangeLog index 0dcd3c0dca..61f68406b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2021-12-18 Paul Eggert + + nstrftime: simplify by using libc-config.h. + * lib/nstrftime.c [!_LIBC]: Include libc-config.h + instead of config.h. + (iso_week_days): Simplify via libc-config.h’s __inline. + (my_strftime): Simplify via libc-config.h’s libc_hidden_def. + * modules/nstrftime (Depends-on): Add libc-config. + 2021-12-18 Bruno Haible libtextstyle-optional: Fix generation of textstyle.h (regr. 2021-12-15). diff --git a/lib/nstrftime.c b/lib/nstrftime.c index 7f258e8727..25baf76c60 100644 --- a/lib/nstrftime.c +++ b/lib/nstrftime.c @@ -22,7 +22,7 @@ # define HAVE_TZNAME 1 # include "../locale/localeinfo.h" #else -# include +# include # if FPRINTFTIME # include "fprintftime.h" # else @@ -367,10 +367,7 @@ tm_diff (const struct tm *a, const struct tm *b) #define ISO_WEEK1_WDAY 4 /* Thursday */ #define YDAY_MINIMUM (-366) static int iso_week_days (int, int); -#if defined __GNUC__ || defined __clang__ -__inline__ -#endif -static int +static __inline int iso_week_days (int yday, int wday) { /* Add enough to the first operand of % to make it nonnegative. */ @@ -428,9 +425,7 @@ my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp, false, 0, -1, &tzset_called extra_args LOCALE_ARG); } -#if defined _LIBC && ! FPRINTFTIME libc_hidden_def (my_strftime) -#endif /* Just like my_strftime, above, but with more parameters. UPCASE indicates that the result should be converted to upper case. diff --git a/modules/nstrftime b/modules/nstrftime index 64e255cdec..a24af8dcb3 100644 --- a/modules/nstrftime +++ b/modules/nstrftime @@ -13,6 +13,7 @@ c99 errno extensions intprops +libc-config stdbool time_rz