diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2015-12-11 22:27:30 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2015-12-11 22:27:30 (GMT) |
commit | a1afbb92c4ef37e6c164b74a889f319c8fd343d6 (patch) | |
tree | 2196fe9bf6d1f586e239ffe46e19ee54ada2f683 /generic/tclClock.c | |
parent | 215f237f9dcb0bedcb02d73ee24a6ad04715cde7 (diff) | |
parent | ae04607901c12a74a8fc87f174e461640a4004d6 (diff) | |
download | tcl-empty_bodies.zip tcl-empty_bodies.tar.gz tcl-empty_bodies.tar.bz2 |
merge trunkempty_bodies
Diffstat (limited to 'generic/tclClock.c')
-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); |