gnucash master: Remove gmtime_r and localtime_r from lib/libc. They're no longer used.

John Ralls jralls at code.gnucash.org
Sat Jul 25 15:49:28 EDT 2015


Updated	 via  https://github.com/Gnucash/gnucash/commit/e7aa53a7 (commit)
	from  https://github.com/Gnucash/gnucash/commit/290dd611 (commit)



commit e7aa53a75e834c7270eb0b0180e94cb7d0d22848
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Jul 25 12:50:17 2015 -0700

    Remove gmtime_r and localtime_r from lib/libc. They're no longer used.

diff --git a/configure.ac b/configure.ac
index 8cc707f..6e1b720 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1384,10 +1384,7 @@ then
   AC_SUBST(WEBKIT_CFLAGS)
   AC_SUBST(WEBKIT_LIBS)
 
-  dnl if Mac OSX, also scrub /sw/include
-  dnl GIVEN_CFLAGS=$(echo $GIVEN_CFLAGS | sed -e "s;-I/sw/include ;;" | sed -e "s;-I/sw/include$;;")
-
-  ###-----------------------------------------------------------------------
+    ###-----------------------------------------------------------------------
   ## Find a suitable password store
   AC_ARG_ENABLE([password-storage],
                 AS_HELP_STRING([--disable-password-storage], [Ignore system wide password stores such as gnome-keyring, libsecret or Apple's keychain]))
@@ -1510,20 +1507,8 @@ then
   AC_DEFINE(GNOME_DISABLE_DEPRECATED,1, [Don't use deprecated gnome functions])
 fi
 
-###-------------------------------------------------------------------------
-### Stuff from Mac OS X Port
-###-------------------------------------------------------------------------
-
 AC_CHECK_FUNCS(pthread_mutex_init)
-case $host_os in
-  darwin*)
-    AC_REPLACE_FUNCS(localtime_r gmtime_r)
-    AC_LIBOBJ(strptime)
-    ;;
-  *)
-    AC_REPLACE_FUNCS(strptime localtime_r gmtime_r strfmon)
-    ;;
-esac
+AC_REPLACE_FUNCS(strptime strfmon)
 
 if test x$am_cv_val_LC_MESSAGES = "xno"; then
   LC_MESSAGES_ENUM="LC_ALL"
diff --git a/lib/libc/Makefile.am b/lib/libc/Makefile.am
index 56754db..f0b9509 100644
--- a/lib/libc/Makefile.am
+++ b/lib/libc/Makefile.am
@@ -2,8 +2,6 @@ noinst_LTLIBRARIES = libc-missing.la
 
 # All header files must be listed.
 noinst_HEADERS = \
-  gmtime_r.h \
-  localtime_r.h \
   setenv.h \
   strfmon.h \
   strptime.h \
@@ -13,8 +11,6 @@ noinst_HEADERS = \
 libc_missing_la_SOURCES = libc-missing-noop.c
 
 EXTRA_libc_missing_la_SOURCES = \
-  gmtime_r.c \
-  localtime_r.c \
   setenv.c \
   strfmon.c \
   strptime.c
diff --git a/lib/libc/gmtime_r.c b/lib/libc/gmtime_r.c
deleted file mode 100644
index f378ea5..0000000
--- a/lib/libc/gmtime_r.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/********************************************************************
- * File: gmtime_r.c
- * Renamed from: core-utils.h
- *
- * Copyright (C) 2001 Linux Developers Group
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- ********************************************************************/
-
-#include "config.h"
-
-#if !HAVE_GMTIME_R
-#include <time.h>
-#include <string.h>
-#include "gmtime_r.h"
-
-#if HAVE_PTHREAD_MUTEX_INIT
-#include <pthread.h>
-#ifdef gmtime_r
-#undef gmtime_r
-#endif
-
-struct tm *
-gmtime_r(const time_t *const timep, struct tm *p_tm)
-{
-    static pthread_mutex_t time_mutex;
-    static int time_mutex_inited = 0;
-    struct tm *tmp;
-
-    if (!time_mutex_inited)
-    {
-        time_mutex_inited = 1;
-        pthread_mutex_init(&time_mutex, NULL);
-    }
-
-    pthread_mutex_lock(&time_mutex);
-    tmp = gmtime(timep);
-    if (tmp)
-    {
-        memcpy(p_tm, tmp, sizeof(struct tm));
-        tmp = p_tm;
-    }
-    pthread_mutex_unlock(&time_mutex);
-
-    return tmp;
-}
-#else
-struct tm *
-gmtime_r(const time_t *const timep, struct tm *p_tm)
-{
-    static struct tm* tmp;
-    tmp = gmtime(timep);
-    if (tmp)
-    {
-        memcpy(p_tm, tmp, sizeof(struct tm));
-        tmp = p_tm;
-    }
-    return tmp;
-}
-#endif /* HAVE_PTHREAD_MUTEX_INIT */
-
-#endif /* !HAVE_GMTIME_R */
diff --git a/lib/libc/gmtime_r.h b/lib/libc/gmtime_r.h
deleted file mode 100644
index 51e442c..0000000
--- a/lib/libc/gmtime_r.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/********************************************************************
- * File: gmtime_r.h
- *
- * Copyright (C) 2001 Linux Developers Group
- * Copyright (C) 2009 Phil Longstaff <plongstaff at rogers.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- ********************************************************************/
-
-#ifndef __GMTIME_R_H__
-#define __GMTIME_R_H__
-
-#if !HAVE_GMTIME_R
-#include <time.h>
-/*
- * Version of "gmtime_r()", for the benefit of OSes that don't have it.
- */
-extern struct tm *gmtime_r(const time_t *const timep, struct tm *p_tm);
-#endif
-
-#endif
-
diff --git a/lib/libc/localtime_r.c b/lib/libc/localtime_r.c
deleted file mode 100644
index 738ad85..0000000
--- a/lib/libc/localtime_r.c
+++ /dev/null
@@ -1,56 +0,0 @@
-
-#include "config.h"
-
-#if !HAVE_LOCALTIME_R
-#include <time.h>
-#include <string.h>
-#include "localtime_r.h"
-
-#if HAVE_PTHREAD_MUTEX_INIT
-#include <pthread.h>
-
-/* New mingw pthread package seems to define localtime_r as a macro */
-#ifdef localtime_r
-#undef localtime_r
-#endif
-
-struct tm *
-localtime_r(const time_t *const timep, struct tm *p_tm)
-{
-    static pthread_mutex_t time_mutex;
-    static int time_mutex_inited = 0;
-    struct tm *tmp;
-
-    if (!time_mutex_inited)
-    {
-        time_mutex_inited = 1;
-        pthread_mutex_init(&time_mutex, NULL);
-    }
-
-    pthread_mutex_lock(&time_mutex);
-    tmp = localtime(timep);
-    if (tmp)
-    {
-        memcpy(p_tm, tmp, sizeof(struct tm));
-        tmp = p_tm;
-    }
-    pthread_mutex_unlock(&time_mutex);
-
-    return tmp;
-}
-#else
-struct tm *
-localtime_r(const time_t *const timep, struct tm *p_tm)
-{
-    static struct tm* tmp;
-    tmp = localtime(timep);
-    if (tmp)
-    {
-        memcpy(p_tm, tmp, sizeof(struct tm));
-        tmp = p_tm;
-    }
-    return tmp;
-}
-#endif /* HAVE_PTHREAD_MUTEX_INIT */
-
-#endif /* !HAVE_LOCALTIME_R */
diff --git a/lib/libc/localtime_r.h b/lib/libc/localtime_r.h
deleted file mode 100644
index 96fa503..0000000
--- a/lib/libc/localtime_r.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __LOCALTIME_R_H__
-#define __LOCALTIME_R_H__
-#include <time.h>
-/*
- * Version of "localtime_r()", for the benefit of OSes that don't have it.
- */
-extern struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
-
-#endif
-
diff --git a/src/backend/dbi/gnc-backend-dbi.c b/src/backend/dbi/gnc-backend-dbi.c
index 8c96bd0..ccdf251 100644
--- a/src/backend/dbi/gnc-backend-dbi.c
+++ b/src/backend/dbi/gnc-backend-dbi.c
@@ -36,9 +36,6 @@
 #include <errno.h>
 #include <glib.h>
 #include <glib/gstdio.h>
-#if !HAVE_GMTIME_R
-#include "gmtime_r.h"
-#endif
 
 #include "gnc-backend-dbi-priv.h"
 
diff --git a/src/gnome-utils/gnc-date-format.c b/src/gnome-utils/gnc-date-format.c
index 27fabba..cab0209 100644
--- a/src/gnome-utils/gnc-date-format.c
+++ b/src/gnome-utils/gnc-date-format.c
@@ -41,10 +41,6 @@
 #include "dialog-utils.h"
 #include "gnc-engine.h"
 
-#ifndef HAVE_LOCALTIME_R
-# include "localtime_r.h"
-#endif
-
 /* Perhaps it's better just to use MAX_DATE_LENGTH defined in gnc-date.h */
 #define MAX_DATE_LEN 80
 
diff --git a/src/libqof/CMakeLists.txt b/src/libqof/CMakeLists.txt
index 4f9c516..80f91b0 100644
--- a/src/libqof/CMakeLists.txt
+++ b/src/libqof/CMakeLists.txt
@@ -40,8 +40,6 @@ IF (WIN32)
   SET (libgnc_qof_SOURCES ${libgnc_qof_SOURCES}
     qof/qof-win32.c
 	../../lib/libc/strptime.c
-	../../lib/libc/localtime_r.c
-	../../lib/libc/gmtime_r.c
   )
 ENDIF (WIN32)
 
diff --git a/src/libqof/qof/qoflog.cpp b/src/libqof/qof/qoflog.cpp
index faf9781..f33b882 100644
--- a/src/libqof/qof/qoflog.cpp
+++ b/src/libqof/qof/qoflog.cpp
@@ -54,10 +54,6 @@ extern "C"
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN "qof.log"
 
-#ifndef HAVE_LOCALTIME_R
-#include "localtime_r.h"
-#endif
-
 #ifdef __cplusplus
 }
 #endif



Summary of changes:
 configure.ac                      | 19 ++--------
 lib/libc/Makefile.am              |  4 ---
 lib/libc/gmtime_r.c               | 75 ---------------------------------------
 lib/libc/gmtime_r.h               | 35 ------------------
 lib/libc/localtime_r.c            | 56 -----------------------------
 lib/libc/localtime_r.h            | 10 ------
 src/backend/dbi/gnc-backend-dbi.c |  3 --
 src/gnome-utils/gnc-date-format.c |  4 ---
 src/libqof/CMakeLists.txt         |  2 --
 src/libqof/qof/qoflog.cpp         |  4 ---
 10 files changed, 2 insertions(+), 210 deletions(-)
 delete mode 100644 lib/libc/gmtime_r.c
 delete mode 100644 lib/libc/gmtime_r.h
 delete mode 100644 lib/libc/localtime_r.c
 delete mode 100644 lib/libc/localtime_r.h



More information about the gnucash-changes mailing list