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

This commit is contained in:
John Ralls 2015-07-25 12:50:17 -07:00
parent 290dd611d7
commit e7aa53a75e
10 changed files with 2 additions and 210 deletions

View File

@ -1384,10 +1384,7 @@ then
AC_SUBST(WEBKIT_CFLAGS) AC_SUBST(WEBKIT_CFLAGS)
AC_SUBST(WEBKIT_LIBS) 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 ## Find a suitable password store
AC_ARG_ENABLE([password-storage], 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])) 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]) AC_DEFINE(GNOME_DISABLE_DEPRECATED,1, [Don't use deprecated gnome functions])
fi fi
###-------------------------------------------------------------------------
### Stuff from Mac OS X Port
###-------------------------------------------------------------------------
AC_CHECK_FUNCS(pthread_mutex_init) AC_CHECK_FUNCS(pthread_mutex_init)
case $host_os in AC_REPLACE_FUNCS(strptime strfmon)
darwin*)
AC_REPLACE_FUNCS(localtime_r gmtime_r)
AC_LIBOBJ(strptime)
;;
*)
AC_REPLACE_FUNCS(strptime localtime_r gmtime_r strfmon)
;;
esac
if test x$am_cv_val_LC_MESSAGES = "xno"; then if test x$am_cv_val_LC_MESSAGES = "xno"; then
LC_MESSAGES_ENUM="LC_ALL" LC_MESSAGES_ENUM="LC_ALL"

View File

@ -2,8 +2,6 @@ noinst_LTLIBRARIES = libc-missing.la
# All header files must be listed. # All header files must be listed.
noinst_HEADERS = \ noinst_HEADERS = \
gmtime_r.h \
localtime_r.h \
setenv.h \ setenv.h \
strfmon.h \ strfmon.h \
strptime.h \ strptime.h \
@ -13,8 +11,6 @@ noinst_HEADERS = \
libc_missing_la_SOURCES = libc-missing-noop.c libc_missing_la_SOURCES = libc-missing-noop.c
EXTRA_libc_missing_la_SOURCES = \ EXTRA_libc_missing_la_SOURCES = \
gmtime_r.c \
localtime_r.c \
setenv.c \ setenv.c \
strfmon.c \ strfmon.c \
strptime.c strptime.c

View File

@ -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 */

View File

@ -1,35 +0,0 @@
/********************************************************************
* File: gmtime_r.h
*
* Copyright (C) 2001 Linux Developers Group
* Copyright (C) 2009 Phil Longstaff <plongstaff@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

View File

@ -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 */

View File

@ -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

View File

@ -36,9 +36,6 @@
#include <errno.h> #include <errno.h>
#include <glib.h> #include <glib.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#if !HAVE_GMTIME_R
#include "gmtime_r.h"
#endif
#include "gnc-backend-dbi-priv.h" #include "gnc-backend-dbi-priv.h"

View File

@ -41,10 +41,6 @@
#include "dialog-utils.h" #include "dialog-utils.h"
#include "gnc-engine.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 */ /* Perhaps it's better just to use MAX_DATE_LENGTH defined in gnc-date.h */
#define MAX_DATE_LEN 80 #define MAX_DATE_LEN 80

View File

@ -40,8 +40,6 @@ IF (WIN32)
SET (libgnc_qof_SOURCES ${libgnc_qof_SOURCES} SET (libgnc_qof_SOURCES ${libgnc_qof_SOURCES}
qof/qof-win32.c qof/qof-win32.c
../../lib/libc/strptime.c ../../lib/libc/strptime.c
../../lib/libc/localtime_r.c
../../lib/libc/gmtime_r.c
) )
ENDIF (WIN32) ENDIF (WIN32)

View File

@ -54,10 +54,6 @@ extern "C"
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "qof.log" #define G_LOG_DOMAIN "qof.log"
#ifndef HAVE_LOCALTIME_R
#include "localtime_r.h"
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif