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>
Paul Mackerras committed
May 2, 2015 at 20:53 UTC
009409fe72e53ce5a3c7cf6802d7e068632e68e8
1 file changed
+56
-56
gitk
+56
-56
@@ -600,18 +600,18 @@ proc reloadcommits {} {
600
}
601
resetvarcs $curview
602
set selectedline {}
603
- catch {unset currentid}
604
- catch {unset thickerline}
605
- catch {unset treediffs}
603
+ unset -nocomplain currentid
604
+ unset -nocomplain thickerline
605
+ unset -nocomplain treediffs
606
readrefs
607
changedrefs
608
if {$showneartags} {
609
getallcommits
610
}
611
clear_display
612
- catch {unset commitinterest}
613
- catch {unset cached_commitrow}
614
- catch {unset targetid}
612
+ unset -nocomplain commitinterest
613
+ unset -nocomplain cached_commitrow
614
+ unset -nocomplain targetid
615
setcanvscroll
616
getcommits $selid
617
return 0
@@ -673,7 +673,7 @@ proc resetvarcs {view} {
673
foreach vd [array names vseedcount $view,*] {
674
unset vseedcount($vd)
675
}
676
- catch {unset ordertok}
676
+ unset -nocomplain ordertok
677
}
678
679
# returns a list of the commits with no children
@@ -966,7 +966,7 @@ proc insertrow {id p v} {
966
set vp $v,$p
967
if {[llength [lappend children($vp) $id]] > 1} {
968
set children($vp) [lsort -command [list vtokcmp $v] $children($vp)]
969
- catch {unset ordertok}
969
+ unset -nocomplain ordertok
970
}
971
fix_reversal $p $a $v
972
incr commitidx($v)
@@ -1136,7 +1136,7 @@ proc update_arcrows {v} {
1136
set displayorder [lrange $displayorder 0 [expr {$vrowmod($v) - 1}]]
1137
set parentlist [lrange $parentlist 0 [expr {$vrowmod($v) - 1}]]
1138
}
1139
- catch {unset cached_commitrow}
1139
+ unset -nocomplain cached_commitrow
1140
}
1141
set narctot [expr {[llength $varctok($v)] - 1}]
1142
set a $varcmod($v)
@@ -1579,7 +1579,7 @@ proc getcommitlines {fd inst view updating} {
1579
[vtokcmp $view [lindex $children($vp) end-1] $id] > 0} {
1580
set children($vp) [lsort -command [list vtokcmp $view] \
1581
$children($vp)]
1582
- catch {unset ordertok}
1582
+ unset -nocomplain ordertok
1583
}
1584
if {[info exists varcid($view,$p)]} {
1585
fix_reversal $p $a $view
@@ -1778,7 +1778,7 @@ proc readrefs {} {
1778
global hideremotes
1779
1780
foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
1781
- catch {unset $v}
1781
+ unset -nocomplain $v
1782
}
1783
set refd [open [list | git show-ref -d] r]
1784
while {[gets $refd line] >= 0} {
@@ -3389,7 +3389,7 @@ proc init_flist {first} {
3389
set cflist_top 1
3390
$cflist tag add highlight 1.0 "1.0 lineend"
3391
} else {
3392
- catch {unset cflist_top}
3392
+ unset -nocomplain cflist_top
3393
}
3394
$cflist conf -state disabled
3395
set difffilestart {}
@@ -4438,15 +4438,15 @@ proc showview {n} {
4438
}
4439
unselectline
4440
normalline
4441
- catch {unset treediffs}
4441
+ unset -nocomplain treediffs
4442
clear_display
4443
if {[info exists hlview] && $hlview == $n} {
4444
unset hlview
4445
set selectedhlview [mc "None"]
4446
}
4447
- catch {unset commitinterest}
4448
- catch {unset cached_commitrow}
4449
- catch {unset ordertok}
4447
+ unset -nocomplain commitinterest
4448
+ unset -nocomplain cached_commitrow
4449
+ unset -nocomplain ordertok
4450
4451
set curview $n
4452
set selectedview $n
@@ -4466,8 +4466,8 @@ proc showview {n} {
4466
set rowfinal {}
4467
set numcommits $commitidx($n)
4468
4469
- catch {unset colormap}
4470
- catch {unset rowtextx}
4469
+ unset -nocomplain colormap
4470
+ unset -nocomplain rowtextx
4471
set nextcolor 0
4472
set canvxmax [$canv cget -width]
4473
set curview $n
@@ -4601,7 +4601,7 @@ proc delvhighlight {} {
4601
4602
if {![info exists hlview]} return
4603
unset hlview
4604
- catch {unset vhighlights}
4604
+ unset -nocomplain vhighlights
4605
unbolden
4606
}
4607
@@ -4649,7 +4649,7 @@ proc hfiles_change {} {
4649
# delete previous highlights
4650
catch {close $filehighlight}
4651
unset filehighlight
4652
- catch {unset fhighlights}
4652
+ unset -nocomplain fhighlights
4653
unbolden
4654
unhighlight_filelist
4655
}
@@ -4710,7 +4710,7 @@ proc findcom_change args {
4710
bolden_name $id mainfont
4711
}
4712
set boldnameids {}
4713
- catch {unset nhighlights}
4713
+ unset -nocomplain nhighlights
4714
unbolden
4715
unmarkmatches
4716
if {$gdttype ne [mc "containing:"] || $findstring eq {}} {
@@ -4913,9 +4913,9 @@ proc rhighlight_sel {a} {
4913
global descendent desc_todo ancestor anc_todo
4914
global highlight_related
4915
4916
- catch {unset descendent}
4916
+ unset -nocomplain descendent
4917
set desc_todo [list $a]
4918
- catch {unset ancestor}
4918
+ unset -nocomplain ancestor
4919
set anc_todo [list $a]
4920
if {$highlight_related ne [mc "None"]} {
4921
rhighlight_none
@@ -4926,7 +4926,7 @@ proc rhighlight_sel {a} {
4926
proc rhighlight_none {} {
4927
global rhighlights
4928
4929
- catch {unset rhighlights}
4929
+ unset -nocomplain rhighlights
4930
unbolden
4931
}
4932
@@ -5134,8 +5134,8 @@ proc initlayout {} {
5134
set rowisopt {}
5135
set rowfinal {}
5136
set canvxmax [$canv cget -width]
5137
- catch {unset colormap}
5138
- catch {unset rowtextx}
5137
+ unset -nocomplain colormap
5138
+ unset -nocomplain rowtextx
5139
setcanvscroll
5140
}
5141
@@ -6368,17 +6368,17 @@ proc clear_display {} {
6368
global linehtag linentag linedtag boldids boldnameids
6369
6370
allcanvs delete all
6371
- catch {unset iddrawn}
6372
- catch {unset linesegs}
6373
- catch {unset linehtag}
6374
- catch {unset linentag}
6375
- catch {unset linedtag}
6371
+ unset -nocomplain iddrawn
6372
+ unset -nocomplain linesegs
6373
+ unset -nocomplain linehtag
6374
+ unset -nocomplain linentag
6375
+ unset -nocomplain linedtag
6376
set boldids {}
6377
set boldnameids {}
6378
- catch {unset vhighlights}
6379
- catch {unset fhighlights}
6380
- catch {unset nhighlights}
6381
- catch {unset rhighlights}
6378
+ unset -nocomplain vhighlights
6379
+ unset -nocomplain fhighlights
6380
+ unset -nocomplain nhighlights
6381
+ unset -nocomplain rhighlights
6382
set need_redisplay 0
6383
set nrows_drawn 0
6384
}
@@ -7226,7 +7226,7 @@ proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
7226
global autoselect autosellen jump_to_here
7227
global vinlinediff
7228
7229
- catch {unset pending_select}
7229
+ unset -nocomplain pending_select
7230
$canv delete hover
7231
normalline
7232
unsel_reflist
@@ -7424,7 +7424,7 @@ proc unselectline {} {
7424
global selectedline currentid
7425
7426
set selectedline {}
7427
- catch {unset currentid}
7427
+ unset -nocomplain currentid
7428
allcanvs delete secsel
7429
rhighlight_none
7430
}
@@ -7480,7 +7480,7 @@ proc unset_posvars {} {
7480
if {[info exists last_posvars]} {
7481
foreach {var val} $last_posvars {
7482
global $var
7483
- catch {unset $var}
7483
+ unset -nocomplain $var
7484
}
7485
unset last_posvars
7486
}
@@ -7548,7 +7548,7 @@ proc gettree {id} {
7548
global nullid nullid2
7549
7550
set diffids $id
7551
- catch {unset diffmergeid}
7551
+ unset -nocomplain diffmergeid
7552
if {![info exists treefilelist($id)]} {
7553
if {![info exists treepending]} {
7554
if {$id eq $nullid} {
@@ -7704,7 +7704,7 @@ proc startdiff {ids} {
7704
7705
settabs 1
7706
set diffids $ids
7707
- catch {unset diffmergeid}
7707
+ unset -nocomplain diffmergeid
7708
if {![info exists treediffs($ids)] ||
7709
[lsearch -exact $ids $nullid] >= 0 ||
7710
[lsearch -exact $ids $nullid2] >= 0} {
@@ -8325,7 +8325,7 @@ proc clear_ctext {{first 1.0}} {
8325
}
8326
$ctext delete $first end
8327
if {$first eq "1.0"} {
8328
- catch {unset pendinglinks}
8328
+ unset -nocomplain pendinglinks
8329
}
8330
set ctext_file_names {}
8331
set ctext_file_lines {}
@@ -8501,7 +8501,7 @@ proc scrolltext {f0 f1} {
8501
highlightfile_for_scrollpos $topidx
8502
}
8503
8504
- catch {unset suppress_highlighting_file_for_this_scrollpos}
8504
+ unset -nocomplain suppress_highlighting_file_for_this_scrollpos
8505
8506
.bleft.bottom.sb set $f0 $f1
8507
if {$searchstring ne {}} {
@@ -10103,9 +10103,9 @@ proc getallclines {fd} {
10103
}
10104
if {$nid > 0} {
10105
global cached_dheads cached_dtags cached_atags
10106
- catch {unset cached_dheads}
10107
- catch {unset cached_dtags}
10108
- catch {unset cached_atags}
10106
+ unset -nocomplain cached_dheads
10107
+ unset -nocomplain cached_dtags
10108
+ unset -nocomplain cached_atags
10109
}
10110
if {![eof $fd]} {
10111
return [expr {$nid >= 1000? 2: 1}]
@@ -10345,7 +10345,7 @@ proc dropcache {err} {
10345
foreach v {arcnos arcout arcids arcstart arcend growing \
10346
arctags archeads allparents allchildren} {
10347
global $v
10348
- catch {unset $v}
10348
+ unset -nocomplain $v
10349
}
10350
set allcwait 0
10351
set nextarc 0
@@ -10996,8 +10996,8 @@ proc addedtag {id} {
10996
if {![info exists arcout($id)]} {
10997
recalcarc [lindex $arcnos($id) 0]
10998
}
10999
- catch {unset cached_dtags}
11000
- catch {unset cached_atags}
10999
+ unset -nocomplain cached_dtags
11000
+ unset -nocomplain cached_atags
11001
}
11002
11003
proc addedhead {hid head} {
@@ -11007,13 +11007,13 @@ proc addedhead {hid head} {
11007
if {![info exists arcout($hid)]} {
11008
recalcarc [lindex $arcnos($hid) 0]
11009
}
11010
- catch {unset cached_dheads}
11010
+ unset -nocomplain cached_dheads
11011
}
11012
11013
proc removedhead {hid head} {
11014
global cached_dheads
11015
11016
- catch {unset cached_dheads}
11016
+ unset -nocomplain cached_dheads
11017
}
11018
11019
proc movedhead {hid head} {
@@ -11023,7 +11023,7 @@ proc movedhead {hid head} {
11023
if {![info exists arcout($hid)]} {
11024
recalcarc [lindex $arcnos($hid) 0]
11025
}
11026
- catch {unset cached_dheads}
11026
+ unset -nocomplain cached_dheads
11027
}
11028
11029
proc changedrefs {} {
@@ -11039,10 +11039,10 @@ proc changedrefs {} {
11039
}
11040
}
11041
}
11042
- catch {unset cached_tagcontent}
11043
- catch {unset cached_dtags}
11044
- catch {unset cached_atags}
11045
- catch {unset cached_dheads}
11042
+ unset -nocomplain cached_tagcontent
11043
+ unset -nocomplain cached_dtags
11044
+ unset -nocomplain cached_atags
11045
+ unset -nocomplain cached_dheads
11046
}
11047
11048
proc rereadrefs {} {
@@ -11628,7 +11628,7 @@ proc prefsok {} {
11628
($perfile_attrs && !$oldprefs(perfile_attrs))} {
11629
# treediffs elements are limited by path;
11630
# won't have encodings cached if perfile_attrs was just turned on
11631
- catch {unset treediffs}
11631
+ unset -nocomplain treediffs
11632
}
11633
if {$fontchanged || $maxwidth != $oldprefs(maxwidth)
11634
|| $maxgraphpct != $oldprefs(maxgraphpct)} {