mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 15:56:23 +01:00
Test for localtime_r only after including the right MT enabling CFLAGS
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * configure.in: Test for localtime_r only after including the right MT enabling CFLAGS (i.e. -D_REENTRANT on most systems). * gdate.c (g_date_set_time): Emit warning, if no localtime_r function is available on thread enabled systems. Define ptm only, if really needed, and assert on it.
This commit is contained in:
parent
f4a2520f38
commit
e5e86f8c6c
@ -1,3 +1,12 @@
|
|||||||
|
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in: Test for localtime_r only after including the
|
||||||
|
right MT enabling CFLAGS (i.e. -D_REENTRANT on most systems).
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): Emit warning, if no localtime_r
|
||||||
|
function is available on thread enabled systems. Define ptm only,
|
||||||
|
if really needed, and assert on it.
|
||||||
|
|
||||||
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* testglib.c:
|
* testglib.c:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in: Test for localtime_r only after including the
|
||||||
|
right MT enabling CFLAGS (i.e. -D_REENTRANT on most systems).
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): Emit warning, if no localtime_r
|
||||||
|
function is available on thread enabled systems. Define ptm only,
|
||||||
|
if really needed, and assert on it.
|
||||||
|
|
||||||
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* testglib.c:
|
* testglib.c:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in: Test for localtime_r only after including the
|
||||||
|
right MT enabling CFLAGS (i.e. -D_REENTRANT on most systems).
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): Emit warning, if no localtime_r
|
||||||
|
function is available on thread enabled systems. Define ptm only,
|
||||||
|
if really needed, and assert on it.
|
||||||
|
|
||||||
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* testglib.c:
|
* testglib.c:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in: Test for localtime_r only after including the
|
||||||
|
right MT enabling CFLAGS (i.e. -D_REENTRANT on most systems).
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): Emit warning, if no localtime_r
|
||||||
|
function is available on thread enabled systems. Define ptm only,
|
||||||
|
if really needed, and assert on it.
|
||||||
|
|
||||||
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* testglib.c:
|
* testglib.c:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in: Test for localtime_r only after including the
|
||||||
|
right MT enabling CFLAGS (i.e. -D_REENTRANT on most systems).
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): Emit warning, if no localtime_r
|
||||||
|
function is available on thread enabled systems. Define ptm only,
|
||||||
|
if really needed, and assert on it.
|
||||||
|
|
||||||
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* testglib.c:
|
* testglib.c:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in: Test for localtime_r only after including the
|
||||||
|
right MT enabling CFLAGS (i.e. -D_REENTRANT on most systems).
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): Emit warning, if no localtime_r
|
||||||
|
function is available on thread enabled systems. Define ptm only,
|
||||||
|
if really needed, and assert on it.
|
||||||
|
|
||||||
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* testglib.c:
|
* testglib.c:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in: Test for localtime_r only after including the
|
||||||
|
right MT enabling CFLAGS (i.e. -D_REENTRANT on most systems).
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): Emit warning, if no localtime_r
|
||||||
|
function is available on thread enabled systems. Define ptm only,
|
||||||
|
if really needed, and assert on it.
|
||||||
|
|
||||||
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* testglib.c:
|
* testglib.c:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in: Test for localtime_r only after including the
|
||||||
|
right MT enabling CFLAGS (i.e. -D_REENTRANT on most systems).
|
||||||
|
|
||||||
|
* gdate.c (g_date_set_time): Emit warning, if no localtime_r
|
||||||
|
function is available on thread enabled systems. Define ptm only,
|
||||||
|
if really needed, and assert on it.
|
||||||
|
|
||||||
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* testglib.c:
|
* testglib.c:
|
||||||
|
@ -254,7 +254,7 @@ AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
|
|||||||
AC_CHECK_HEADER(alloca.h, glib_have_alloca_h=yes, glib_have_alloca_h=no)
|
AC_CHECK_HEADER(alloca.h, glib_have_alloca_h=yes, glib_have_alloca_h=no)
|
||||||
|
|
||||||
# Check for some functions
|
# Check for some functions
|
||||||
AC_CHECK_FUNCS(localtime_r rand_r lstat strerror strsignal memmove vsnprintf vasprintf strcasecmp strncasecmp poll)
|
AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf vasprintf strcasecmp strncasecmp poll)
|
||||||
|
|
||||||
# Check for sys_errlist
|
# Check for sys_errlist
|
||||||
AC_MSG_CHECKING(for sys_errlist)
|
AC_MSG_CHECKING(for sys_errlist)
|
||||||
@ -717,6 +717,8 @@ AC_SUBST(G_THREAD_LIBS)
|
|||||||
|
|
||||||
CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
|
CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS(localtime_r rand_r)
|
||||||
|
|
||||||
dnl **********************************************
|
dnl **********************************************
|
||||||
dnl *** GDefaultMutex setup and initialization ***
|
dnl *** GDefaultMutex setup and initialization ***
|
||||||
dnl **********************************************
|
dnl **********************************************
|
||||||
|
13
gdate.c
13
gdate.c
@ -790,15 +790,22 @@ g_date_set_time (GDate *d,
|
|||||||
GTime time)
|
GTime time)
|
||||||
{
|
{
|
||||||
time_t t = time;
|
time_t t = time;
|
||||||
struct tm tm, *ptm;
|
struct tm tm;
|
||||||
|
|
||||||
g_return_if_fail (d != NULL);
|
g_return_if_fail (d != NULL);
|
||||||
|
|
||||||
#if HAVE_LOCALTIME_R
|
#ifdef HAVE_LOCALTIME_R
|
||||||
localtime_r (&t, &tm);
|
localtime_r (&t, &tm);
|
||||||
#else
|
#else
|
||||||
ptm = localtime (&t);
|
# ifdef G_THREADS_ENABLED
|
||||||
|
# warning "the `g_date_set_time' function will not be MT-safe"
|
||||||
|
# warning "because there is no `localtime_r' on your system."
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
struct tm *ptm = localtime (&t);
|
||||||
|
g_assert (ptm);
|
||||||
memcpy ((void *) &tm, (void *) ptm, sizeof(struct tm));
|
memcpy ((void *) &tm, (void *) ptm, sizeof(struct tm));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
d->julian = FALSE;
|
d->julian = FALSE;
|
||||||
|
13
glib/gdate.c
13
glib/gdate.c
@ -790,15 +790,22 @@ g_date_set_time (GDate *d,
|
|||||||
GTime time)
|
GTime time)
|
||||||
{
|
{
|
||||||
time_t t = time;
|
time_t t = time;
|
||||||
struct tm tm, *ptm;
|
struct tm tm;
|
||||||
|
|
||||||
g_return_if_fail (d != NULL);
|
g_return_if_fail (d != NULL);
|
||||||
|
|
||||||
#if HAVE_LOCALTIME_R
|
#ifdef HAVE_LOCALTIME_R
|
||||||
localtime_r (&t, &tm);
|
localtime_r (&t, &tm);
|
||||||
#else
|
#else
|
||||||
ptm = localtime (&t);
|
# ifdef G_THREADS_ENABLED
|
||||||
|
# warning "the `g_date_set_time' function will not be MT-safe"
|
||||||
|
# warning "because there is no `localtime_r' on your system."
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
struct tm *ptm = localtime (&t);
|
||||||
|
g_assert (ptm);
|
||||||
memcpy ((void *) &tm, (void *) ptm, sizeof(struct tm));
|
memcpy ((void *) &tm, (void *) ptm, sizeof(struct tm));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
d->julian = FALSE;
|
d->julian = FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user