[tz] question about mktime_tzname()

Paul Eggert eggert at cs.ucla.edu
Tue Jan 17 23:27:07 UTC 2017


On 01/13/2017 07:55 AM, Paul Eggert wrote:
> Perhaps private.h should be split into two (a
> portable part, and a non-portable part)

Instead of doing that, I installed the attached proposed patches, in
which zdump.c always includes private.h and which omits the duplicated
code. Since private.h is independent of tzfile format, this should be OK.
-------------- next part --------------
From 8e606cd1b4c6a8bd2277a003f136b588f7feae2a Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert at cs.ucla.edu>
Date: Tue, 17 Jan 2017 14:26:28 -0800
Subject: [PROPOSED 1/2] Use angle brackets for system includes

This is the more-usual style nowadays, and makes it easier to
distinguish system includes from our includes.
---
 date.c      |  2 +-
 localtime.c |  2 +-
 private.h   | 18 +++++++++---------
 strftime.c  |  4 ++--
 zdump.c     | 18 +++++++++---------
 zic.c       |  2 +-
 6 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/date.c b/date.c
index 512d1ef..866091f 100644
--- a/date.c
+++ b/date.c
@@ -28,7 +28,7 @@
    SUCH DAMAGE.  */
 
 #include "private.h"
-#include "locale.h"
+#include <locale.h>
 
 /*
 ** The two things date knows about time are. . .
diff --git a/localtime.c b/localtime.c
index cc2a3d2..afc7438 100644
--- a/localtime.c
+++ b/localtime.c
@@ -14,7 +14,7 @@
 #include "private.h"
 
 #include "tzfile.h"
-#include "fcntl.h"
+#include <fcntl.h>
 
 #if defined THREAD_SAFE && THREAD_SAFE
 # include <pthread.h>
diff --git a/private.h b/private.h
index 0bd1d00..88210ab 100644
--- a/private.h
+++ b/private.h
@@ -104,13 +104,13 @@
 #undef tzalloc
 #undef tzfree
 
-#include "sys/types.h"	/* for time_t */
-#include "stdio.h"
-#include "string.h"
-#include "limits.h"	/* for CHAR_BIT et al. */
-#include "stdlib.h"
+#include <sys/types.h>	/* for time_t */
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>	/* for CHAR_BIT et al. */
+#include <stdlib.h>
 
-#include "errno.h"
+#include <errno.h>
 
 #ifndef ENAMETOOLONG
 # define ENAMETOOLONG EINVAL
@@ -123,7 +123,7 @@
 #endif
 
 #if HAVE_GETTEXT
-#include "libintl.h"
+#include <libintl.h>
 #endif /* HAVE_GETTEXT */
 
 #if HAVE_SYS_WAIT_H
@@ -138,7 +138,7 @@
 #endif /* !defined WEXITSTATUS */
 
 #if HAVE_UNISTD_H
-#include "unistd.h"	/* for F_OK, R_OK, and other POSIX goodness */
+#include <unistd.h>	/* for F_OK, R_OK, and other POSIX goodness */
 #endif /* HAVE_UNISTD_H */
 
 #ifndef HAVE_STRFTIME_L
@@ -173,7 +173,7 @@
 #endif /* !defined HAVE_STDINT_H */
 
 #if HAVE_STDINT_H
-#include "stdint.h"
+#include <stdint.h>
 #endif /* !HAVE_STDINT_H */
 
 #ifndef HAVE_INTTYPES_H
diff --git a/strftime.c b/strftime.c
index 2bfb6c1..3920b10 100644
--- a/strftime.c
+++ b/strftime.c
@@ -36,8 +36,8 @@
 #include "private.h"
 
 #include "tzfile.h"
-#include "fcntl.h"
-#include "locale.h"
+#include <fcntl.h>
+#include <locale.h>
 
 struct lc_time_T {
 	const char *	mon[MONSPERYEAR];
diff --git a/zdump.c b/zdump.c
index 1ddc6c6..64c5ac6 100644
--- a/zdump.c
+++ b/zdump.c
@@ -33,12 +33,12 @@
 /* Enable strtoimax on Solaris 10.  */
 #define __EXTENSIONS__ 1
 
-#include "stdio.h"	/* for stdout, stderr, perror */
-#include "string.h"	/* for strcpy */
-#include "sys/types.h"	/* for time_t */
-#include "time.h"	/* for struct tm */
-#include "stdlib.h"	/* for exit, malloc, atoi */
-#include "limits.h"	/* for CHAR_BIT, LLONG_MAX */
+#include <stdio.h>	/* for stdout, stderr, perror */
+#include <string.h>	/* for strcpy */
+#include <sys/types.h>	/* for time_t */
+#include <time.h>	/* for struct tm */
+#include <stdlib.h>	/* for exit, malloc, atoi */
+#include <limits.h>	/* for CHAR_BIT, LLONG_MAX */
 #include <errno.h>
 
 #ifndef HAVE_POSIX_DECLS
@@ -60,7 +60,7 @@
      || __CYGWIN__ || INTMAX_MAX)
 #endif
 #if HAVE_STDINT_H
-# include "stdint.h"
+# include <stdint.h>
 #endif
 #ifndef HAVE_INTTYPES_H
 # define HAVE_INTTYPES_H HAVE_STDINT_H
@@ -245,8 +245,8 @@ enum { SECSPER400YEARS_FITS = SECSPERLYEAR <= INTMAX_MAX / 400 };
 #define HAVE_GETTEXT 0
 #endif
 #if HAVE_GETTEXT
-#include "locale.h"	/* for setlocale */
-#include "libintl.h"
+#include <locale.h>	/* for setlocale */
+#include <libintl.h>
 #endif /* HAVE_GETTEXT */
 
 #if 2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)
diff --git a/zic.c b/zic.c
index 04798f4..068fb43 100644
--- a/zic.c
+++ b/zic.c
@@ -5,10 +5,10 @@
 
 #include "version.h"
 #include "private.h"
-#include "locale.h"
 #include "tzfile.h"
 
 #include <fcntl.h>
+#include <locale.h>
 #include <stdarg.h>
 #include <stddef.h>
 
-- 
2.9.3
-------------- next part --------------
From af1ebd6bbbc0eec68335935fff5515d29a764b4c Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert at cs.ucla.edu>
Date: Tue, 17 Jan 2017 15:20:25 -0800
Subject: [PROPOSED 2/2] Remove duplication between private.h and zdump.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* NEWS: Document this.
* asctime.c, strftime.c:
Do not include tzfile.h, since this source file is independent of
tz binary file format.
* private.h (TYPE_BIT, TYPE_SIGNED, INT_STRLEN_MAXIMUM, _)
(YEARSPERREPEAT, AVGSECSPERYEAR, SECSPERREPEAT)
(SECSPERREPEAT_BITS): Don’t worry about whether these are already
defined, as these macros are not intended to be overridden by the
user.
* private.h, tzfile.h (SECSPERMIN, MINSPERHOUR, HOURSPERDAY, DAYSPERWEEK)
(DAYSPERNYEAR, DAYSPERLYEAR, SECSPERHOUR, SECSPERDAY)
(MONSPERYEAR, TM_SUNDAY, TM_MONDAY, TM_TUESDAY, TM_WEDNESDAY)
(TM_THURSDAY, TM_FRIDAY, TM_SATURDAY, TM_JANUARY, TM_FEBRUARY)
(TM_MARCH, TM_APRIL, TM_MAY, TM_JUNE, TM_JULY, TM_AUGUST)
(TM_SEPTEMBER, TM_OCTOBER, TM_NOVEMBER, TM_DECEMBER)
(TM_YEAR_BASE, EPOCH_YEAR, EPOCH_WDAY, isleap, isleap_sum):
Move from tzfile.h to private.h, as these macros are independent
of file format.
* zdump.c: Always include private.h.
Do not include files that private.h already includes for us.
Remove definitions that are duplicates of what is in private.h.

Use angle brackets for system includes
This is the more-usual style nowadays, and makes it easier to
distinguish system includes from our includes.
---
 NEWS       |   3 +
 asctime.c  |   1 -
 private.h  |  78 ++++++++++++++++-------
 strftime.c |   1 -
 tzfile.h   |  52 ----------------
 zdump.c    | 208 +------------------------------------------------------------
 6 files changed, 61 insertions(+), 282 deletions(-)

diff --git a/NEWS b/NEWS
index 900ccbb..1934c1a 100644
--- a/NEWS
+++ b/NEWS
@@ -70,6 +70,9 @@ Unreleased, experimental changes
     zdump is now buildable again with -DUSE_LTZ=0.
     (Problem reported bny Joseph Myers.)
 
+    zdump.c now always includes private.h, to avoid code duplication
+    with private.h.  (Problem reported by Kees Dekker.)
+
     localtime.c no longer mishandles early or late timestamps
     when TZ is set to a POSIX-style string that specifies DST.
     (Problem reported by Kees Dekker.)
diff --git a/asctime.c b/asctime.c
index 1a906b6..85ebf88 100644
--- a/asctime.c
+++ b/asctime.c
@@ -12,7 +12,6 @@
 /*LINTLIBRARY*/
 
 #include "private.h"
-#include "tzfile.h"
 
 /*
 ** Some systems only handle "%.2d"; others only handle "%02d";
diff --git a/private.h b/private.h
index 88210ab..e2f23f5 100644
--- a/private.h
+++ b/private.h
@@ -500,14 +500,8 @@ time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_PURE;
 # include <stdbool.h>
 #endif
 
-#ifndef TYPE_BIT
 #define TYPE_BIT(type)	(sizeof (type) * CHAR_BIT)
-#endif /* !defined TYPE_BIT */
-
-#ifndef TYPE_SIGNED
 #define TYPE_SIGNED(type) (((type) -1) < 0)
-#endif /* !defined TYPE_SIGNED */
-
 #define TWOS_COMPLEMENT(t) ((t) ~ (t) 0 < 0)
 
 /* Max and min values of the integer type T, of which only the bottom
@@ -542,7 +536,6 @@ static time_t const time_t_min = MINVAL(time_t, TYPE_BIT(time_t));
 static time_t const time_t_max = MAXVAL(time_t, TYPE_BIT(time_t));
 #endif
 
-#ifndef INT_STRLEN_MAXIMUM
 /*
 ** 302 / 1000 is log10(2.0) rounded up.
 ** Subtract one for the sign bit if the type is signed;
@@ -552,7 +545,6 @@ static time_t const time_t_max = MAXVAL(time_t, TYPE_BIT(time_t));
 #define INT_STRLEN_MAXIMUM(type) \
 	((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
 	1 + TYPE_SIGNED(type))
-#endif /* !defined INT_STRLEN_MAXIMUM */
 
 /*
 ** INITIALIZE(x)
@@ -574,13 +566,11 @@ static time_t const time_t_max = MAXVAL(time_t, TYPE_BIT(time_t));
 ** The default is to use gettext if available, and use MSGID otherwise.
 */
 
-#ifndef _
 #if HAVE_GETTEXT
 #define _(msgid) gettext(msgid)
 #else /* !HAVE_GETTEXT */
 #define _(msgid) msgid
 #endif /* !HAVE_GETTEXT */
-#endif /* !defined _ */
 
 #if !defined TZ_DOMAIN && defined HAVE_GETTEXT
 # define TZ_DOMAIN "tz"
@@ -593,24 +583,70 @@ char *asctime_r(struct tm const *, char *);
 char *ctime_r(time_t const *, char *);
 #endif /* HAVE_INCOMPATIBLE_CTIME_R */
 
-#ifndef YEARSPERREPEAT
+/* Handy macros that are independent of tzfile implementation.  */
+
 #define YEARSPERREPEAT		400	/* years before a Gregorian repeat */
-#endif /* !defined YEARSPERREPEAT */
+
+#define SECSPERMIN	60
+#define MINSPERHOUR	60
+#define HOURSPERDAY	24
+#define DAYSPERWEEK	7
+#define DAYSPERNYEAR	365
+#define DAYSPERLYEAR	366
+#define SECSPERHOUR	(SECSPERMIN * MINSPERHOUR)
+#define SECSPERDAY	((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
+#define MONSPERYEAR	12
+
+#define TM_SUNDAY	0
+#define TM_MONDAY	1
+#define TM_TUESDAY	2
+#define TM_WEDNESDAY	3
+#define TM_THURSDAY	4
+#define TM_FRIDAY	5
+#define TM_SATURDAY	6
+
+#define TM_JANUARY	0
+#define TM_FEBRUARY	1
+#define TM_MARCH	2
+#define TM_APRIL	3
+#define TM_MAY		4
+#define TM_JUNE		5
+#define TM_JULY		6
+#define TM_AUGUST	7
+#define TM_SEPTEMBER	8
+#define TM_OCTOBER	9
+#define TM_NOVEMBER	10
+#define TM_DECEMBER	11
+
+#define TM_YEAR_BASE	1900
+
+#define EPOCH_YEAR	1970
+#define EPOCH_WDAY	TM_THURSDAY
+
+#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
 
 /*
-** The Gregorian year averages 365.2425 days, which is 31556952 seconds.
+** Since everything in isleap is modulo 400 (or a factor of 400), we know that
+**	isleap(y) == isleap(y % 400)
+** and so
+**	isleap(a + b) == isleap((a + b) % 400)
+** or
+**	isleap(a + b) == isleap(a % 400 + b % 400)
+** This is true even if % means modulo rather than Fortran remainder
+** (which is allowed by C89 but not C99).
+** We use this to avoid addition overflow problems.
 */
 
-#ifndef AVGSECSPERYEAR
-#define AVGSECSPERYEAR		31556952L
-#endif /* !defined AVGSECSPERYEAR */
+#define isleap_sum(a, b)	isleap((a) % 400 + (b) % 400)
 
-#ifndef SECSPERREPEAT
-#define SECSPERREPEAT		((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR)
-#endif /* !defined SECSPERREPEAT */
 
-#ifndef SECSPERREPEAT_BITS
+/*
+** The Gregorian year averages 365.2425 days, which is 31556952 seconds.
+*/
+
+#define AVGSECSPERYEAR		31556952L
+#define SECSPERREPEAT \
+  ((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR)
 #define SECSPERREPEAT_BITS	34	/* ceil(log2(SECSPERREPEAT)) */
-#endif /* !defined SECSPERREPEAT_BITS */
 
 #endif /* !defined PRIVATE_H */
diff --git a/strftime.c b/strftime.c
index 3920b10..a0454ce 100644
--- a/strftime.c
+++ b/strftime.c
@@ -35,7 +35,6 @@
 
 #include "private.h"
 
-#include "tzfile.h"
 #include <fcntl.h>
 #include <locale.h>
 
diff --git a/tzfile.h b/tzfile.h
index ebecd68..0e51dce 100644
--- a/tzfile.h
+++ b/tzfile.h
@@ -114,56 +114,4 @@ struct tzhead {
 #define TZ_MAX_LEAPS	50	/* Maximum number of leap second corrections */
 #endif /* !defined TZ_MAX_LEAPS */
 
-#define SECSPERMIN	60
-#define MINSPERHOUR	60
-#define HOURSPERDAY	24
-#define DAYSPERWEEK	7
-#define DAYSPERNYEAR	365
-#define DAYSPERLYEAR	366
-#define SECSPERHOUR	(SECSPERMIN * MINSPERHOUR)
-#define SECSPERDAY	((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
-#define MONSPERYEAR	12
-
-#define TM_SUNDAY	0
-#define TM_MONDAY	1
-#define TM_TUESDAY	2
-#define TM_WEDNESDAY	3
-#define TM_THURSDAY	4
-#define TM_FRIDAY	5
-#define TM_SATURDAY	6
-
-#define TM_JANUARY	0
-#define TM_FEBRUARY	1
-#define TM_MARCH	2
-#define TM_APRIL	3
-#define TM_MAY		4
-#define TM_JUNE		5
-#define TM_JULY		6
-#define TM_AUGUST	7
-#define TM_SEPTEMBER	8
-#define TM_OCTOBER	9
-#define TM_NOVEMBER	10
-#define TM_DECEMBER	11
-
-#define TM_YEAR_BASE	1900
-
-#define EPOCH_YEAR	1970
-#define EPOCH_WDAY	TM_THURSDAY
-
-#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
-
-/*
-** Since everything in isleap is modulo 400 (or a factor of 400), we know that
-**	isleap(y) == isleap(y % 400)
-** and so
-**	isleap(a + b) == isleap((a + b) % 400)
-** or
-**	isleap(a + b) == isleap(a % 400 + b % 400)
-** This is true even if % means modulo rather than Fortran remainder
-** (which is allowed by C89 but not C99).
-** We use this to avoid addition overflow problems.
-*/
-
-#define isleap_sum(a, b)	isleap((a) % 400 + (b) % 400)
-
 #endif /* !defined TZFILE_H */
diff --git a/zdump.c b/zdump.c
index 64c5ac6..a2567bd 100644
--- a/zdump.c
+++ b/zdump.c
@@ -19,101 +19,7 @@
 # define USE_LTZ 1
 #endif
 
-#if USE_LTZ
-# include "private.h"
-#endif
-
-/*
-** Substitutes for pre-C99 and pre-POSIX platforms.
-** Much of this section of code is stolen from private.h.
-*/
-
-/* Enable tm_gmtoff and tm_zone on GNUish systems.  */
-#define _GNU_SOURCE 1
-/* Enable strtoimax on Solaris 10.  */
-#define __EXTENSIONS__ 1
-
-#include <stdio.h>	/* for stdout, stderr, perror */
-#include <string.h>	/* for strcpy */
-#include <sys/types.h>	/* for time_t */
-#include <time.h>	/* for struct tm */
-#include <stdlib.h>	/* for exit, malloc, atoi */
-#include <limits.h>	/* for CHAR_BIT, LLONG_MAX */
-#include <errno.h>
-
-#ifndef HAVE_POSIX_DECLS
-# define HAVE_POSIX_DECLS 1
-#endif
-
-#ifndef HAVE_UNISTD_H
-# define HAVE_UNISTD_H 1
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#ifndef HAVE_STDINT_H
-# define HAVE_STDINT_H \
-    (199901 <= __STDC_VERSION__ \
-     || 2 < __GLIBC__ + (1 <= __GLIBC_MINOR__)	\
-     || __CYGWIN__ || INTMAX_MAX)
-#endif
-#if HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifndef HAVE_INTTYPES_H
-# define HAVE_INTTYPES_H HAVE_STDINT_H
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-
-#ifndef INT_FAST32_MAX
-# if INT_MAX >> 31 == 0
-typedef long int_fast32_t;
-# else
-typedef int int_fast32_t;
-# endif
-#endif
-
-/* Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX.  */
-#if !defined LLONG_MAX && defined __LONG_LONG_MAX__
-# define LLONG_MAX __LONG_LONG_MAX__
-#endif
-
-#ifndef INTMAX_MAX
-# ifdef LLONG_MAX
-typedef long long intmax_t;
-#  define strtoimax strtoll
-#  define INTMAX_MAX LLONG_MAX
-# else
-typedef long intmax_t;
-#  define strtoimax strtol
-#  define INTMAX_MAX LONG_MAX
-# endif
-#endif
-
-#ifndef PRIdMAX
-# if INTMAX_MAX == LLONG_MAX
-#  define PRIdMAX "lld"
-# else
-#  define PRIdMAX "ld"
-# endif
-#endif
-
-/* Infer TM_ZONE on systems where this information is known, but suppress
-   guessing if NO_TM_ZONE is defined.  Similarly for TM_GMTOFF.  */
-#if (defined __GLIBC__ \
-     || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ \
-     || (defined __APPLE__ && defined __MACH__))
-# if !defined TM_GMTOFF && !defined NO_TM_GMTOFF
-#  define TM_GMTOFF tm_gmtoff
-# endif
-# if !defined TM_ZONE && !defined NO_TM_ZONE
-#  define TM_ZONE tm_zone
-# endif
-#endif
+#include "private.h"
 
 #ifndef HAVE_LOCALTIME_R
 # define HAVE_LOCALTIME_R 1
@@ -143,90 +49,6 @@ typedef long intmax_t;
 #define MAX_STRING_LENGTH	1024
 #endif /* !defined MAX_STRING_LENGTH */
 
-#if __STDC_VERSION__ < 199901
-# define true 1
-# define false 0
-# define bool int
-#else
-# include <stdbool.h>
-#endif
-
-#ifndef TYPE_BIT
-#define TYPE_BIT(type)	(sizeof (type) * CHAR_BIT)
-#endif /* !defined TYPE_BIT */
-
-#ifndef TYPE_SIGNED
-#define TYPE_SIGNED(type) (((type) -1) < 0)
-#endif /* !defined TYPE_SIGNED */
-
-#ifndef INT_STRLEN_MAXIMUM
-/*
-** 302 / 1000 is log10(2.0) rounded up.
-** Subtract one for the sign bit if the type is signed;
-** add one for integer division truncation;
-** add one more for a minus sign if the type is signed.
-*/
-#define INT_STRLEN_MAXIMUM(type) \
-	((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
-	1 + TYPE_SIGNED(type))
-#endif /* !defined INT_STRLEN_MAXIMUM */
-
-#ifndef INITIALIZE
-# ifdef lint
-#  define INITIALIZE(x)	((x) = 0)
-# else
-#  define INITIALIZE(x)
-# endif
-#endif
-
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS	0
-#endif /* !defined EXIT_SUCCESS */
-
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE	1
-#endif /* !defined EXIT_FAILURE */
-
-#ifndef SECSPERMIN
-#define SECSPERMIN	60
-#endif /* !defined SECSPERMIN */
-
-#ifndef MINSPERHOUR
-#define MINSPERHOUR	60
-#endif /* !defined MINSPERHOUR */
-
-#ifndef SECSPERHOUR
-#define SECSPERHOUR	(SECSPERMIN * MINSPERHOUR)
-#endif /* !defined SECSPERHOUR */
-
-#ifndef HOURSPERDAY
-#define HOURSPERDAY	24
-#endif /* !defined HOURSPERDAY */
-
-#ifndef EPOCH_YEAR
-#define EPOCH_YEAR	1970
-#endif /* !defined EPOCH_YEAR */
-
-#ifndef TM_YEAR_BASE
-#define TM_YEAR_BASE	1900
-#endif /* !defined TM_YEAR_BASE */
-
-#ifndef DAYSPERNYEAR
-#define DAYSPERNYEAR	365
-#endif /* !defined DAYSPERNYEAR */
-
-#ifndef isleap
-#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
-#endif /* !defined isleap */
-
-#ifndef isleap_sum
-/*
-** See tzfile.h for details on isleap_sum.
-*/
-#define isleap_sum(a, b)	isleap((a) % 400 + (b) % 400)
-#endif /* !defined isleap_sum */
-
-#define SECSPERDAY	((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
 #define SECSPERNYEAR	(SECSPERDAY * DAYSPERNYEAR)
 #define SECSPERLYEAR	(SECSPERNYEAR + SECSPERDAY)
 #define SECSPER400YEARS	(SECSPERNYEAR * (intmax_t) (300 + 3)	\
@@ -241,38 +63,10 @@ typedef long intmax_t;
 */
 enum { SECSPER400YEARS_FITS = SECSPERLYEAR <= INTMAX_MAX / 400 };
 
-#ifndef HAVE_GETTEXT
-#define HAVE_GETTEXT 0
-#endif
 #if HAVE_GETTEXT
 #include <locale.h>	/* for setlocale */
-#include <libintl.h>
 #endif /* HAVE_GETTEXT */
 
-#if 2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)
-# define ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define ATTRIBUTE_PURE /* empty */
-#endif
-
-/*
-** For the benefit of GNU folk...
-** '_(MSGID)' uses the current locale's message library string for MSGID.
-** The default is to use gettext if available, and use MSGID otherwise.
-*/
-
-#ifndef _
-#if HAVE_GETTEXT
-#define _(msgid) gettext(msgid)
-#else /* !HAVE_GETTEXT */
-#define _(msgid) msgid
-#endif /* !HAVE_GETTEXT */
-#endif /* !defined _ */
-
-#if !defined TZ_DOMAIN && defined HAVE_GETTEXT
-# define TZ_DOMAIN "tz"
-#endif
-
 #if ! HAVE_LOCALTIME_RZ
 # undef  timezone_t
 # define timezone_t char **
-- 
2.9.3


More information about the tz mailing list