1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2026-05-09 08:15:57 +00:00

Remove lint when debugging by compiling with -Dtime_tz='whatever'.

* localtime.c (LOCALTIME_IMPLEMENTATION): New macro.
(time) [time_tz]: Move here from private.h, and make external.
* private.h (sys_time) [time_tz]: Define only if
LOCALTIME_IMPLEMENTATION, so that the code doesn't define an unused
static function sys_time that the compiler might complain about.
(time) [time_tz]: Move to localtime.c.
* NEWS: Document this.
This commit is contained in:
Paul Eggert
2014-08-16 01:57:33 -07:00
parent 6bc7f54afa
commit aedcce3e83
3 changed files with 23 additions and 10 deletions

3
NEWS
View File

@@ -47,7 +47,8 @@ Unreleased, experimental changes
the date it updates the wtmpx file if _PATH_WTMPX is defined.
This affects GNU/Linux and similar systems.
Some C code has been simplified for easier maintenance later.
For easier maintenance later, some C code has been simplified
and some lint has been removed.
Changes affecting distribution tarballs

View File

@@ -10,7 +10,9 @@
/*LINTLIBRARY*/
#define LOCALTIME_IMPLEMENTATION
#include "private.h"
#include "tzfile.h"
#include "fcntl.h"
@@ -2022,3 +2024,19 @@ posix2time(time_t t)
}
#endif /* defined STD_INSPIRED */
#ifdef time_tz
/* Convert from the underlying system's time_t to the ersatz time_tz,
which is called 'time_t' in this file. */
time_t
time(time_t *p)
{
time_t r = sys_time(0);
if (p)
*p = r;
return r;
}
#endif

View File

@@ -248,7 +248,9 @@ typedef unsigned long uintmax_t;
** typical platforms.
*/
#ifdef time_tz
# ifdef LOCALTIME_IMPLEMENTATION
static time_t sys_time(time_t *x) { return time(x); }
# endif
# undef ctime
# define ctime tz_ctime
@@ -289,15 +291,7 @@ struct tm *gmtime_r(time_t const *restrict, struct tm *restrict);
struct tm *localtime(time_t const *);
struct tm *localtime_r(time_t const *restrict, struct tm *restrict);
time_t mktime(struct tm *);
static time_t
time(time_t *p)
{
time_t r = sys_time(0);
if (p)
*p = r;
return r;
}
time_t time(time_t *);
#endif
/*