From d9a79d52dafdcdf2079951636d5ec6f1ac96a15b Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Fri, 2 Dec 2005 22:13:41 +0000 Subject: another puny speedup - no error thrown from ::tcl::clock::getenv --- ChangeLog | 11 ++++++----- generic/tclClock.c | 11 ++++------- library/clock.tcl | 6 +++--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index bd8f205..496dff8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,11 @@ 2005-12-02 Kevin B. Kenny - * library/clock.tcl: Moved a tiny bit more of [clock format] from - run time to compile time, and fixed a l10n bug in the process. - [Bug 1371446]. Also, conditoned the call to SetupTimeZone to speed - the common case where TZData($timezone) already exists. - + * generic/tclClock.c: Moved a tiny bit more of [clock format] from + * library/clock.tcl: run time to compile time, and fixed a l10n + bug in the process. [Bug 1371446]. Also, conditoned the call to + SetupTimeZone to speed the common case where TZData($timezone) + already exists, and achieved a puny speedup by making + ::tcl::clock::getenv not throw errors. * unix/Makefile.in: Made some changes to support a 'make' command that is present on some antiquated versions of Solaris. diff --git a/generic/tclClock.c b/generic/tclClock.c index 522f6b1..69abb95 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclClock.c,v 1.48 2005/12/01 06:11:40 das Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.49 2005/12/02 22:13:41 kennykb Exp $ */ #include "tclInt.h" @@ -1481,13 +1481,10 @@ ClockGetenvObjCmd( varName = Tcl_GetStringFromObj(objv[1], NULL); varValue = getenv(varName); if (varValue == NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("variable not found", -1)); - return TCL_ERROR; - } else { - Tcl_SetObjResult(interp, Tcl_NewStringObj(varValue, -1)); - return TCL_OK; + varValue = ""; } + Tcl_SetObjResult(interp, Tcl_NewStringObj(varValue, -1)); + return TCL_OK; } /* diff --git a/library/clock.tcl b/library/clock.tcl index 95924ae..4c64c27 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: clock.tcl,v 1.27 2005/12/02 19:47:36 kennykb Exp $ +# RCS: @(#) $Id: clock.tcl,v 1.28 2005/12/02 22:13:41 kennykb Exp $ # #---------------------------------------------------------------------- @@ -3087,9 +3087,9 @@ proc ::tcl::clock::GetSystemTimeZone {} { variable CachedSystemTimeZone variable TimeZoneBad - if { ![catch {getenv TCL_TZ} result] } { + if {[set result [getenv TCL_TZ]] ne {}} { set timezone $result - } elseif { ![catch {getenv TZ} result] } { + } elseif {[set result [getenv TZ]] ne {}} { set timezone $result } elseif { [info exists CachedSystemTimeZone] } { set timezone $CachedSystemTimeZone -- cgit v0.12