[tz] [PROPOSED PATCH] localtime.c: two minor 'bool' cleanups
Paul Eggert
eggert at cs.ucla.edu
Tue Aug 26 18:22:17 UTC 2014
These don't fix any bugs, but make the recently-introduced 'bool'
code easier to follow.
* localtime.c (gmtcheck): Move gmt_is_set's definition here,
since it's used only here.
(localtime_r): Explicitly convert integer to boolean rather
than relying on C99 semantics.
---
localtime.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/localtime.c b/localtime.c
index d5fd508..aee343e 100644
--- a/localtime.c
+++ b/localtime.c
@@ -177,7 +177,6 @@ static struct state gmtmem;
static char lcl_TZname[TZ_STRLEN_MAX + 1];
static int VOLATILE lcl_is_set;
-static bool VOLATILE gmt_is_set;
char * tzname[2] = {
(char *) wildabbr,
@@ -1262,6 +1261,7 @@ tzset(void)
static void
gmtcheck(void)
{
+ static bool VOLATILE gmt_is_set;
if (gmt_is_set)
return;
if (lock() != 0)
@@ -1415,7 +1415,7 @@ localtime(const time_t *const timep)
struct tm *
localtime_r(const time_t *const timep, struct tm *tmp)
{
- return localtime_tzset(timep, tmp, lcl_is_set);
+ return localtime_tzset(timep, tmp, lcl_is_set != 0);
}
/*
--
1.9.1
More information about the tz
mailing list