summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-11 07:28:14 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-11 07:28:14 (GMT)
commitf796d623675cfb8a59b1c190470f785c61b90a8e (patch)
treef50e689312394cf955d4247d6236507827fc2fcd
parentf5ac592def2fc9aed2314cfa3015e377247d599c (diff)
downloadtcl-f796d623675cfb8a59b1c190470f785c61b90a8e.zip
tcl-f796d623675cfb8a59b1c190470f785c61b90a8e.tar.gz
tcl-f796d623675cfb8a59b1c190470f785c61b90a8e.tar.bz2
Use $index<0 in stead of $index==-1 consistantly
-rw-r--r--library/http/http.tcl2
-rw-r--r--library/init.tcl4
-rw-r--r--library/safe.tcl2
-rw-r--r--library/tcltest/tcltest.tcl6
-rw-r--r--tests/httpTest.tcl2
5 files changed, 8 insertions, 8 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index 192867e..4117f44 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -544,7 +544,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 e62d05d..94f65cf 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -245,7 +245,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
}
@@ -742,7 +742,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 c6e653f..6090a46 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"
diff --git a/tests/httpTest.tcl b/tests/httpTest.tcl
index 4345845..7491fb4 100644
--- a/tests/httpTest.tcl
+++ b/tests/httpTest.tcl
@@ -153,7 +153,7 @@ proc httpTest::TestOverlaps {someResults n term msg badTrans notPiped} {
set myStart [lsearch -exact $someResults [list B $i]]
set myEnd [lsearch -exact $someResults [list $term $i]]
- if {($myStart == -1 || $myEnd == -1)} {
+ if {($myStart < 0 || $myEnd < 0)} {
set res "Cannot find positions of transaction $i"
append msg $res \n
Puts $res