From 36e90c74857fdb00fedcdf4801bc1f6686228f89 Mon Sep 17 00:00:00 2001 From: hobbs Date: Sat, 8 Feb 2003 22:03:19 +0000 Subject: code cleanup of eval and string comp use --- ChangeLog | 13 ++++++++----- library/safe.tcl | 14 +++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8dc194..c2e1ed8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,13 +1,16 @@ +2003-02-08 Jeff Hobbs + + * library/safe.tcl: code cleanup of eval and string comp use. + 2003-02-07 Vince Darley - * win/tclWinFCmd.c: cleanup long lines - * win/tclWinFile.c: sped up pure 'glob' by a factor of 3. It - is now faster than Tcl 8.3 - (but 'foreach f [glob *] { file exists $f }' is still slower) + * win/tclWinFCmd.c: cleanup long lines + * win/tclWinFile.c: sped up pure 'glob' by a factor of 2.5 + ('foreach f [glob *] { file exists $f }' is still slow) * tests/fileSystem.text: * tests/fileName.test: added new tests to ensure correct behaviour in optimized filesystem code. - + 2003-02-07 Vince Darley * generic/tclTest.c: diff --git a/library/safe.tcl b/library/safe.tcl index 9faeffe..a259bdb 100644 --- a/library/safe.tcl +++ b/library/safe.tcl @@ -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: safe.tcl,v 1.8 2002/02/22 19:51:29 hobbs Exp $ +# RCS: @(#) $Id: safe.tcl,v 1.9 2003/02/08 22:03:20 hobbs Exp $ # # The implementation is based on namespaces. These naming conventions @@ -294,7 +294,7 @@ namespace eval ::safe { deletehook } { # Create the slave. - if {[string compare "" $slave]} { + if {$slave ne ""} { ::interp create -safe $slave } else { # empty argument: generate slave name @@ -601,7 +601,7 @@ proc ::safe::setLogCmd {args} { # if the slave argument is given, # it will return the corresponding master global variable name proc PathToken {n {slave ""}} { - if {[string compare "" $slave]} { + if {$slave ne ""} { return "[InterpStateName $slave](access_path,$n)" } else { # We need to have a ":" in the token string so @@ -636,15 +636,15 @@ proc ::safe::setLogCmd {args} { } # set/get values proc Set {args} { - eval Toplevel set $args + eval [list Toplevel set] $args } # lappend on toplevel vars proc Lappend {args} { - eval Toplevel lappend $args + eval [list Toplevel lappend] $args } # unset a var/token (currently just an global level eval) proc Unset {args} { - eval Toplevel unset $args + eval [list Toplevel unset] $args } # test existance proc Exists {varname} { @@ -848,7 +848,7 @@ proc ::safe::setLogCmd {args} { proc Subset {slave command okpat args} { set subcommand [lindex $args 0] if {[regexp $okpat $subcommand]} { - return [eval {$command $subcommand} [lrange $args 1 end]] + return [eval [list $command $subcommand] [lrange $args 1 end]] } set msg "not allowed to invoke subcommand $subcommand of $command" Log $slave $msg -- cgit v0.12