gitk: Replace catch {unset foo} with unset -nocomplain foo

This generates better bytecode in Tcl 8.6 according to
http://wiki.tcl.tk/1506.

Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
Paul Mackerras 2015-05-02 20:53:36 +10:00
parent 157c8e3ddf
commit 009409fe72

112
gitk
View File

@ -600,18 +600,18 @@ proc reloadcommits {} {
}
resetvarcs $curview
set selectedline {}
catch {unset currentid}
catch {unset thickerline}
catch {unset treediffs}
unset -nocomplain currentid
unset -nocomplain thickerline
unset -nocomplain treediffs
readrefs
changedrefs
if {$showneartags} {
getallcommits
}
clear_display
catch {unset commitinterest}
catch {unset cached_commitrow}
catch {unset targetid}
unset -nocomplain commitinterest
unset -nocomplain cached_commitrow
unset -nocomplain targetid
setcanvscroll
getcommits $selid
return 0
@ -673,7 +673,7 @@ proc resetvarcs {view} {
foreach vd [array names vseedcount $view,*] {
unset vseedcount($vd)
}
catch {unset ordertok}
unset -nocomplain ordertok
}
# returns a list of the commits with no children
@ -966,7 +966,7 @@ proc insertrow {id p v} {
set vp $v,$p
if {[llength [lappend children($vp) $id]] > 1} {
set children($vp) [lsort -command [list vtokcmp $v] $children($vp)]
catch {unset ordertok}
unset -nocomplain ordertok
}
fix_reversal $p $a $v
incr commitidx($v)
@ -1136,7 +1136,7 @@ proc update_arcrows {v} {
set displayorder [lrange $displayorder 0 [expr {$vrowmod($v) - 1}]]
set parentlist [lrange $parentlist 0 [expr {$vrowmod($v) - 1}]]
}
catch {unset cached_commitrow}
unset -nocomplain cached_commitrow
}
set narctot [expr {[llength $varctok($v)] - 1}]
set a $varcmod($v)
@ -1579,7 +1579,7 @@ proc getcommitlines {fd inst view updating} {
[vtokcmp $view [lindex $children($vp) end-1] $id] > 0} {
set children($vp) [lsort -command [list vtokcmp $view] \
$children($vp)]
catch {unset ordertok}
unset -nocomplain ordertok
}
if {[info exists varcid($view,$p)]} {
fix_reversal $p $a $view
@ -1778,7 +1778,7 @@ proc readrefs {} {
global hideremotes
foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
catch {unset $v}
unset -nocomplain $v
}
set refd [open [list | git show-ref -d] r]
while {[gets $refd line] >= 0} {
@ -3389,7 +3389,7 @@ proc init_flist {first} {
set cflist_top 1
$cflist tag add highlight 1.0 "1.0 lineend"
} else {
catch {unset cflist_top}
unset -nocomplain cflist_top
}
$cflist conf -state disabled
set difffilestart {}
@ -4438,15 +4438,15 @@ proc showview {n} {
}
unselectline
normalline
catch {unset treediffs}
unset -nocomplain treediffs
clear_display
if {[info exists hlview] && $hlview == $n} {
unset hlview
set selectedhlview [mc "None"]
}
catch {unset commitinterest}
catch {unset cached_commitrow}
catch {unset ordertok}
unset -nocomplain commitinterest
unset -nocomplain cached_commitrow
unset -nocomplain ordertok
set curview $n
set selectedview $n
@ -4466,8 +4466,8 @@ proc showview {n} {
set rowfinal {}
set numcommits $commitidx($n)
catch {unset colormap}
catch {unset rowtextx}
unset -nocomplain colormap
unset -nocomplain rowtextx
set nextcolor 0
set canvxmax [$canv cget -width]
set curview $n
@ -4601,7 +4601,7 @@ proc delvhighlight {} {
if {![info exists hlview]} return
unset hlview
catch {unset vhighlights}
unset -nocomplain vhighlights
unbolden
}
@ -4649,7 +4649,7 @@ proc hfiles_change {} {
# delete previous highlights
catch {close $filehighlight}
unset filehighlight
catch {unset fhighlights}
unset -nocomplain fhighlights
unbolden
unhighlight_filelist
}
@ -4710,7 +4710,7 @@ proc findcom_change args {
bolden_name $id mainfont
}
set boldnameids {}
catch {unset nhighlights}
unset -nocomplain nhighlights
unbolden
unmarkmatches
if {$gdttype ne [mc "containing:"] || $findstring eq {}} {
@ -4913,9 +4913,9 @@ proc rhighlight_sel {a} {
global descendent desc_todo ancestor anc_todo
global highlight_related
catch {unset descendent}
unset -nocomplain descendent
set desc_todo [list $a]
catch {unset ancestor}
unset -nocomplain ancestor
set anc_todo [list $a]
if {$highlight_related ne [mc "None"]} {
rhighlight_none
@ -4926,7 +4926,7 @@ proc rhighlight_sel {a} {
proc rhighlight_none {} {
global rhighlights
catch {unset rhighlights}
unset -nocomplain rhighlights
unbolden
}
@ -5134,8 +5134,8 @@ proc initlayout {} {
set rowisopt {}
set rowfinal {}
set canvxmax [$canv cget -width]
catch {unset colormap}
catch {unset rowtextx}
unset -nocomplain colormap
unset -nocomplain rowtextx
setcanvscroll
}
@ -6368,17 +6368,17 @@ proc clear_display {} {
global linehtag linentag linedtag boldids boldnameids
allcanvs delete all
catch {unset iddrawn}
catch {unset linesegs}
catch {unset linehtag}
catch {unset linentag}
catch {unset linedtag}
unset -nocomplain iddrawn
unset -nocomplain linesegs
unset -nocomplain linehtag
unset -nocomplain linentag
unset -nocomplain linedtag
set boldids {}
set boldnameids {}
catch {unset vhighlights}
catch {unset fhighlights}
catch {unset nhighlights}
catch {unset rhighlights}
unset -nocomplain vhighlights
unset -nocomplain fhighlights
unset -nocomplain nhighlights
unset -nocomplain rhighlights
set need_redisplay 0
set nrows_drawn 0
}
@ -7226,7 +7226,7 @@ proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
global autoselect autosellen jump_to_here
global vinlinediff
catch {unset pending_select}
unset -nocomplain pending_select
$canv delete hover
normalline
unsel_reflist
@ -7424,7 +7424,7 @@ proc unselectline {} {
global selectedline currentid
set selectedline {}
catch {unset currentid}
unset -nocomplain currentid
allcanvs delete secsel
rhighlight_none
}
@ -7480,7 +7480,7 @@ proc unset_posvars {} {
if {[info exists last_posvars]} {
foreach {var val} $last_posvars {
global $var
catch {unset $var}
unset -nocomplain $var
}
unset last_posvars
}
@ -7548,7 +7548,7 @@ proc gettree {id} {
global nullid nullid2
set diffids $id
catch {unset diffmergeid}
unset -nocomplain diffmergeid
if {![info exists treefilelist($id)]} {
if {![info exists treepending]} {
if {$id eq $nullid} {
@ -7704,7 +7704,7 @@ proc startdiff {ids} {
settabs 1
set diffids $ids
catch {unset diffmergeid}
unset -nocomplain diffmergeid
if {![info exists treediffs($ids)] ||
[lsearch -exact $ids $nullid] >= 0 ||
[lsearch -exact $ids $nullid2] >= 0} {
@ -8325,7 +8325,7 @@ proc clear_ctext {{first 1.0}} {
}
$ctext delete $first end
if {$first eq "1.0"} {
catch {unset pendinglinks}
unset -nocomplain pendinglinks
}
set ctext_file_names {}
set ctext_file_lines {}
@ -8501,7 +8501,7 @@ proc scrolltext {f0 f1} {
highlightfile_for_scrollpos $topidx
}
catch {unset suppress_highlighting_file_for_this_scrollpos}
unset -nocomplain suppress_highlighting_file_for_this_scrollpos
.bleft.bottom.sb set $f0 $f1
if {$searchstring ne {}} {
@ -10103,9 +10103,9 @@ proc getallclines {fd} {
}
if {$nid > 0} {
global cached_dheads cached_dtags cached_atags
catch {unset cached_dheads}
catch {unset cached_dtags}
catch {unset cached_atags}
unset -nocomplain cached_dheads
unset -nocomplain cached_dtags
unset -nocomplain cached_atags
}
if {![eof $fd]} {
return [expr {$nid >= 1000? 2: 1}]
@ -10345,7 +10345,7 @@ proc dropcache {err} {
foreach v {arcnos arcout arcids arcstart arcend growing \
arctags archeads allparents allchildren} {
global $v
catch {unset $v}
unset -nocomplain $v
}
set allcwait 0
set nextarc 0
@ -10996,8 +10996,8 @@ proc addedtag {id} {
if {![info exists arcout($id)]} {
recalcarc [lindex $arcnos($id) 0]
}
catch {unset cached_dtags}
catch {unset cached_atags}
unset -nocomplain cached_dtags
unset -nocomplain cached_atags
}
proc addedhead {hid head} {
@ -11007,13 +11007,13 @@ proc addedhead {hid head} {
if {![info exists arcout($hid)]} {
recalcarc [lindex $arcnos($hid) 0]
}
catch {unset cached_dheads}
unset -nocomplain cached_dheads
}
proc removedhead {hid head} {
global cached_dheads
catch {unset cached_dheads}
unset -nocomplain cached_dheads
}
proc movedhead {hid head} {
@ -11023,7 +11023,7 @@ proc movedhead {hid head} {
if {![info exists arcout($hid)]} {
recalcarc [lindex $arcnos($hid) 0]
}
catch {unset cached_dheads}
unset -nocomplain cached_dheads
}
proc changedrefs {} {
@ -11039,10 +11039,10 @@ proc changedrefs {} {
}
}
}
catch {unset cached_tagcontent}
catch {unset cached_dtags}
catch {unset cached_atags}
catch {unset cached_dheads}
unset -nocomplain cached_tagcontent
unset -nocomplain cached_dtags
unset -nocomplain cached_atags
unset -nocomplain cached_dheads
}
proc rereadrefs {} {
@ -11628,7 +11628,7 @@ proc prefsok {} {
($perfile_attrs && !$oldprefs(perfile_attrs))} {
# treediffs elements are limited by path;
# won't have encodings cached if perfile_attrs was just turned on
catch {unset treediffs}
unset -nocomplain treediffs
}
if {$fontchanged || $maxwidth != $oldprefs(maxwidth)
|| $maxgraphpct != $oldprefs(maxgraphpct)} {