summaryrefslogtreecommitdiffstats
path: root/generic/tclClock.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-04-20 16:44:13 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-04-20 16:44:13 (GMT)
commit1bbd13e8395085f6afe23f0ac7d7cc91eae3cade (patch)
treedeba5d0dcb60194537aea304ca412bd52ef3c1b6 /generic/tclClock.c
parent66032e8a327e0498b0d8970307452f66c69be25c (diff)
parent049650b5952e5e5ee1997772750450305dccc6d7 (diff)
downloadtcl-1bbd13e8395085f6afe23f0ac7d7cc91eae3cade.zip
tcl-1bbd13e8395085f6afe23f0ac7d7cc91eae3cade.tar.gz
tcl-1bbd13e8395085f6afe23f0ac7d7cc91eae3cade.tar.bz2
Merge 8.6.5little
Diffstat (limited to 'generic/tclClock.c')
-rw-r--r--generic/tclClock.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 9d4bcd6..949cb1c 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -2005,22 +2005,23 @@ ClockSecondsObjCmd(
static void
TzsetIfNecessary(void)
{
- static char *tzWas = NULL; /* Previous value of TZ, protected by
+ static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by
* clockMutex. */
const char *tzIsNow; /* Current value of TZ */
Tcl_MutexLock(&clockMutex);
tzIsNow = getenv("TZ");
- if (tzIsNow != NULL && (tzWas == NULL || strcmp(tzIsNow, tzWas) != 0)) {
+ if (tzIsNow != NULL && (tzWas == NULL || tzWas == INT2PTR(-1)
+ || strcmp(tzIsNow, tzWas) != 0)) {
tzset();
- if (tzWas != NULL) {
+ if (tzWas != NULL && tzWas != INT2PTR(-1)) {
ckfree(tzWas);
}
tzWas = ckalloc(strlen(tzIsNow) + 1);
strcpy(tzWas, tzIsNow);
} else if (tzIsNow == NULL && tzWas != NULL) {
tzset();
- ckfree(tzWas);
+ if (tzWas != INT2PTR(-1)) ckfree(tzWas);
tzWas = NULL;
}
Tcl_MutexUnlock(&clockMutex);