diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-11 08:09:20 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-11 08:09:20 (GMT) |
commit | 0715d88019e40aa514b3b2d3ba691ab7d0a96eb2 (patch) | |
tree | ac95aabe297f6978466d57f62988df8f1abc0577 | |
parent | 2592b1e93b713440a2fab51b01df4ad31bb21f7d (diff) | |
download | tcl-0715d88019e40aa514b3b2d3ba691ab7d0a96eb2.zip tcl-0715d88019e40aa514b3b2d3ba691ab7d0a96eb2.tar.gz tcl-0715d88019e40aa514b3b2d3ba691ab7d0a96eb2.tar.bz2 |
Use $index<0 in stead of $index==-1 consistantly
-rw-r--r-- | library/http/http.tcl | 2 | ||||
-rw-r--r-- | library/init.tcl | 4 | ||||
-rw-r--r-- | library/safe.tcl | 2 | ||||
-rw-r--r-- | library/tcltest/tcltest.tcl | 6 |
4 files changed, 7 insertions, 7 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl index 9d3e5ca..6ca3bad 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -531,7 +531,7 @@ proc http::CloseSocket {s {token {}}} { } else { set map [array get socketMapping] set ndx [lsearch -exact $map $s] - if {$ndx != -1} { + if {$ndx >= 0} { incr ndx -1 set connId [lindex $map $ndx] } diff --git a/library/init.tcl b/library/init.tcl index e6964e0..1028b9e 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -313,7 +313,7 @@ proc unknown args { set errInfo [string range $errInfo 0 $last-1] set tail "\"$cinfo\"" set last [string last $tail $errInfo] - if {$last + [string length $tail] != [string length $errInfo]} { + if {$last < 0 || $last + [string length $tail] != [string length $errInfo]} { return -code error -errorcode $errCode \ -errorinfo $errInfo $msg } @@ -797,7 +797,7 @@ proc tcl::CopyDirectory {action src dest} { } } } else { - if {[string first $nsrc $ndest] != -1} { + if {[string first $nsrc $ndest] >= 0} { set srclen [expr {[llength [file split $nsrc]] - 1}] set ndest [lindex [file split $ndest] $srclen] if {$ndest eq [file tail $nsrc]} { diff --git a/library/safe.tcl b/library/safe.tcl index 48cb0de..5e04453 100644 --- a/library/safe.tcl +++ b/library/safe.tcl @@ -318,7 +318,7 @@ proc ::safe::InterpSetConfig {child access_path staticsok nestedok deletehook} { # Make sure that tcl_library is in auto_path and at the first # position (needed by setAccessPath) set where [lsearch -exact $access_path [info library]] - if {$where == -1} { + if {$where < 0} { # not found, add it. set access_path [linsert $access_path 0 [info library]] Log $child "tcl_library was not in auto_path,\ diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index c894ff1..2af79bc 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -640,7 +640,7 @@ namespace eval tcltest { proc IsVerbose {level} { variable Option - return [expr {[lsearch -exact $Option(-verbose) $level] != -1}] + return [expr {[lsearch -exact $Option(-verbose) $level] >= 0}] } # Default verbosity is to show bodies of failed tests @@ -3107,7 +3107,7 @@ proc tcltest::removeFile {name {directory ""}} { set fullName [file join $directory $name] DebugPuts 3 "[lindex [info level 0] 0]: removing $fullName" set idx [lsearch -exact $filesMade $fullName] - if {$idx == -1} { + if {$idx < 0} { DebugDo 1 { Warn "removeFile removing \"$fullName\":\n not created by makeFile" } @@ -3184,7 +3184,7 @@ proc tcltest::removeDirectory {name {directory ""}} { DebugPuts 3 "[lindex [info level 0] 0]: deleting $fullName" set idx [lsearch -exact $filesMade $fullName] set filesMade [lreplace $filesMade $idx $idx] - if {$idx == -1} { + if {$idx < 0} { DebugDo 1 { Warn "removeDirectory removing \"$fullName\":\n not created\ by makeDirectory" |