bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] nstrftime: simplify by using libc-config.h.


From: Paul Eggert
Subject: [PATCH] nstrftime: simplify by using libc-config.h.
Date: Sat, 18 Dec 2021 11:40:57 -0800

* 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.
---
 ChangeLog         | 9 +++++++++
 lib/nstrftime.c   | 9 ++-------
 modules/nstrftime | 1 +
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0dcd3c0dca..61f68406b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2021-12-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <bruno@clisp.org>
 
        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 <config.h>
+# include <libc-config.h>
 # 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
 
-- 
2.33.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]