]> git.ipfire.org Git - thirdparty/git.git/commitdiff
compat: remove gmtime
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Thu, 14 May 2020 19:18:54 +0000 (12:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 May 2020 20:52:27 +0000 (13:52 -0700)
ccd469450a (date.c: switch to reentrant {gm,local}time_r, 2019-11-28)
removes the only gmtime() call we had and moves to gmtime_r() which
doesn't have the same portability problems.

Remove the compat gmtime code since it is no longer needed, and confirm
by successfull running t4212 in FreeBSD 9.3 amd64 (the oldest I could
get a hold off).

Further work might be needed to ensure 32bit time_t systems (like FreeBSD
i386) will handle correctly the overflows tested in t4212, but that is
orthogonal to this change, and it doesn't change the current behaviour
as neither gmtime() or gmtime_r() will ever return NULL on those systems
because time_t is unsigned.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
compat/gmtime.c [deleted file]
config.mak.uname
git-compat-util.h

index 9cd9826800bc9077b74a0bc5bf0097117212dd73..5e2f8b30c332ea589f01e265407cbc0fd5d0fc1b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -405,9 +405,6 @@ all::
 # with a different indexfile format version.  If it isn't set the index
 # file format used is index-v[23].
 #
-# Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not
-# return NULL when it receives a bogus time_t.
-#
 # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
 #
 # Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
@@ -1801,11 +1798,6 @@ ifndef NO_MSGFMT_EXTENDED_OPTIONS
        MSGFMT += --check --statistics
 endif
 
-ifdef GMTIME_UNRELIABLE_ERRORS
-       COMPAT_OBJS += compat/gmtime.o
-       BASIC_CFLAGS += -DGMTIME_UNRELIABLE_ERRORS
-endif
-
 ifdef HAVE_CLOCK_GETTIME
        BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
 endif
diff --git a/compat/gmtime.c b/compat/gmtime.c
deleted file mode 100644 (file)
index e8362dd..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "../git-compat-util.h"
-#undef gmtime
-#undef gmtime_r
-
-struct tm *git_gmtime(const time_t *timep)
-{
-       static struct tm result;
-       return git_gmtime_r(timep, &result);
-}
-
-struct tm *git_gmtime_r(const time_t *timep, struct tm *result)
-{
-       struct tm *ret;
-
-       memset(result, 0, sizeof(*result));
-       ret = gmtime_r(timep, result);
-
-       /*
-        * Rather than NULL, FreeBSD gmtime simply leaves the "struct tm"
-        * untouched when it encounters overflow. Since "mday" cannot otherwise
-        * be zero, we can test this very quickly.
-        */
-       if (ret && !ret->tm_mday) {
-               ret = NULL;
-               errno = EOVERFLOW;
-       }
-
-       return ret;
-}
index 0ab8e00938397612bc28ea48a218e460a80b1c6a..9aa9a937a9e5ad0897bddf9feb38a662c4ed9d77 100644 (file)
@@ -237,7 +237,6 @@ ifeq ($(uname_S),FreeBSD)
        PYTHON_PATH = /usr/local/bin/python
        PERL_PATH = /usr/local/bin/perl
        HAVE_PATHS_H = YesPlease
-       GMTIME_UNRELIABLE_ERRORS = UnfortunatelyYes
        HAVE_BSD_SYSCTL = YesPlease
        HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
        PAGER_ENV = LESS=FRX LV=-c MORE=FRX
index aed0b5d4f9028a5ae38e8676ec2d1c3a63dfdc97..f1b0a5aa0a4753bb42cd5407cdf7f7ea0b7092da 100644 (file)
@@ -1208,13 +1208,6 @@ int access_or_die(const char *path, int mode, unsigned flag);
 /* Warn on an inaccessible file if errno indicates this is an error */
 int warn_on_fopen_errors(const char *path);
 
-#ifdef GMTIME_UNRELIABLE_ERRORS
-struct tm *git_gmtime(const time_t *);
-struct tm *git_gmtime_r(const time_t *, struct tm *);
-#define gmtime git_gmtime
-#define gmtime_r git_gmtime_r
-#endif
-
 #if !defined(USE_PARENS_AROUND_GETTEXT_N) && defined(__GNUC__)
 #define USE_PARENS_AROUND_GETTEXT_N 1
 #endif