diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2015-12-11 13:17:29 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2015-12-11 13:17:29 (GMT) |
commit | 09cf244213a89d6d5b4f52372ec054fb5bc168f1 (patch) | |
tree | 23c493b68ebb2db8af49c88ff122dd2f12261fbf | |
parent | 3973fecbbfc6e03221f52f78dc5be90285d4e515 (diff) | |
parent | ae04607901c12a74a8fc87f174e461640a4004d6 (diff) | |
download | tcl-09cf244213a89d6d5b4f52372ec054fb5bc168f1.zip tcl-09cf244213a89d6d5b4f52372ec054fb5bc168f1.tar.gz tcl-09cf244213a89d6d5b4f52372ec054fb5bc168f1.tar.bz2 |
merge trunk
-rw-r--r-- | generic/tclClock.c | 9 |
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); |