Skip to content

Commit 009409f

Browse files
committed
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>
1 parent 157c8e3 commit 009409f

1 file changed

Lines changed: 56 additions & 56 deletions

File tree

gitk

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -600,18 +600,18 @@ proc reloadcommits {} {
600600
}
601601
resetvarcs $curview
602602
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
606606
readrefs
607607
changedrefs
608608
if {$showneartags} {
609609
getallcommits
610610
}
611611
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
615615
setcanvscroll
616616
getcommits $selid
617617
return 0
@@ -673,7 +673,7 @@ proc resetvarcs {view} {
673673
foreach vd [array names vseedcount $view,*] {
674674
unset vseedcount($vd)
675675
}
676-
catch {unset ordertok}
676+
unset -nocomplain ordertok
677677
}
678678

679679
# returns a list of the commits with no children
@@ -966,7 +966,7 @@ proc insertrow {id p v} {
966966
set vp $v,$p
967967
if {[llength [lappend children($vp) $id]] > 1} {
968968
set children($vp) [lsort -command [list vtokcmp $v] $children($vp)]
969-
catch {unset ordertok}
969+
unset -nocomplain ordertok
970970
}
971971
fix_reversal $p $a $v
972972
incr commitidx($v)
@@ -1136,7 +1136,7 @@ proc update_arcrows {v} {
11361136
set displayorder [lrange $displayorder 0 [expr {$vrowmod($v) - 1}]]
11371137
set parentlist [lrange $parentlist 0 [expr {$vrowmod($v) - 1}]]
11381138
}
1139-
catch {unset cached_commitrow}
1139+
unset -nocomplain cached_commitrow
11401140
}
11411141
set narctot [expr {[llength $varctok($v)] - 1}]
11421142
set a $varcmod($v)
@@ -1579,7 +1579,7 @@ proc getcommitlines {fd inst view updating} {
15791579
[vtokcmp $view [lindex $children($vp) end-1] $id] > 0} {
15801580
set children($vp) [lsort -command [list vtokcmp $view] \
15811581
$children($vp)]
1582-
catch {unset ordertok}
1582+
unset -nocomplain ordertok
15831583
}
15841584
if {[info exists varcid($view,$p)]} {
15851585
fix_reversal $p $a $view
@@ -1778,7 +1778,7 @@ proc readrefs {} {
17781778
global hideremotes
17791779

17801780
foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
1781-
catch {unset $v}
1781+
unset -nocomplain $v
17821782
}
17831783
set refd [open [list | git show-ref -d] r]
17841784
while {[gets $refd line] >= 0} {
@@ -3389,7 +3389,7 @@ proc init_flist {first} {
33893389
set cflist_top 1
33903390
$cflist tag add highlight 1.0 "1.0 lineend"
33913391
} else {
3392-
catch {unset cflist_top}
3392+
unset -nocomplain cflist_top
33933393
}
33943394
$cflist conf -state disabled
33953395
set difffilestart {}
@@ -4438,15 +4438,15 @@ proc showview {n} {
44384438
}
44394439
unselectline
44404440
normalline
4441-
catch {unset treediffs}
4441+
unset -nocomplain treediffs
44424442
clear_display
44434443
if {[info exists hlview] && $hlview == $n} {
44444444
unset hlview
44454445
set selectedhlview [mc "None"]
44464446
}
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
44504450

44514451
set curview $n
44524452
set selectedview $n
@@ -4466,8 +4466,8 @@ proc showview {n} {
44664466
set rowfinal {}
44674467
set numcommits $commitidx($n)
44684468

4469-
catch {unset colormap}
4470-
catch {unset rowtextx}
4469+
unset -nocomplain colormap
4470+
unset -nocomplain rowtextx
44714471
set nextcolor 0
44724472
set canvxmax [$canv cget -width]
44734473
set curview $n
@@ -4601,7 +4601,7 @@ proc delvhighlight {} {
46014601

46024602
if {![info exists hlview]} return
46034603
unset hlview
4604-
catch {unset vhighlights}
4604+
unset -nocomplain vhighlights
46054605
unbolden
46064606
}
46074607

@@ -4649,7 +4649,7 @@ proc hfiles_change {} {
46494649
# delete previous highlights
46504650
catch {close $filehighlight}
46514651
unset filehighlight
4652-
catch {unset fhighlights}
4652+
unset -nocomplain fhighlights
46534653
unbolden
46544654
unhighlight_filelist
46554655
}
@@ -4710,7 +4710,7 @@ proc findcom_change args {
47104710
bolden_name $id mainfont
47114711
}
47124712
set boldnameids {}
4713-
catch {unset nhighlights}
4713+
unset -nocomplain nhighlights
47144714
unbolden
47154715
unmarkmatches
47164716
if {$gdttype ne [mc "containing:"] || $findstring eq {}} {
@@ -4913,9 +4913,9 @@ proc rhighlight_sel {a} {
49134913
global descendent desc_todo ancestor anc_todo
49144914
global highlight_related
49154915

4916-
catch {unset descendent}
4916+
unset -nocomplain descendent
49174917
set desc_todo [list $a]
4918-
catch {unset ancestor}
4918+
unset -nocomplain ancestor
49194919
set anc_todo [list $a]
49204920
if {$highlight_related ne [mc "None"]} {
49214921
rhighlight_none
@@ -4926,7 +4926,7 @@ proc rhighlight_sel {a} {
49264926
proc rhighlight_none {} {
49274927
global rhighlights
49284928

4929-
catch {unset rhighlights}
4929+
unset -nocomplain rhighlights
49304930
unbolden
49314931
}
49324932

@@ -5134,8 +5134,8 @@ proc initlayout {} {
51345134
set rowisopt {}
51355135
set rowfinal {}
51365136
set canvxmax [$canv cget -width]
5137-
catch {unset colormap}
5138-
catch {unset rowtextx}
5137+
unset -nocomplain colormap
5138+
unset -nocomplain rowtextx
51395139
setcanvscroll
51405140
}
51415141

@@ -6368,17 +6368,17 @@ proc clear_display {} {
63686368
global linehtag linentag linedtag boldids boldnameids
63696369

63706370
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
63766376
set boldids {}
63776377
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
63826382
set need_redisplay 0
63836383
set nrows_drawn 0
63846384
}
@@ -7226,7 +7226,7 @@ proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
72267226
global autoselect autosellen jump_to_here
72277227
global vinlinediff
72287228

7229-
catch {unset pending_select}
7229+
unset -nocomplain pending_select
72307230
$canv delete hover
72317231
normalline
72327232
unsel_reflist
@@ -7424,7 +7424,7 @@ proc unselectline {} {
74247424
global selectedline currentid
74257425

74267426
set selectedline {}
7427-
catch {unset currentid}
7427+
unset -nocomplain currentid
74287428
allcanvs delete secsel
74297429
rhighlight_none
74307430
}
@@ -7480,7 +7480,7 @@ proc unset_posvars {} {
74807480
if {[info exists last_posvars]} {
74817481
foreach {var val} $last_posvars {
74827482
global $var
7483-
catch {unset $var}
7483+
unset -nocomplain $var
74847484
}
74857485
unset last_posvars
74867486
}
@@ -7548,7 +7548,7 @@ proc gettree {id} {
75487548
global nullid nullid2
75497549

75507550
set diffids $id
7551-
catch {unset diffmergeid}
7551+
unset -nocomplain diffmergeid
75527552
if {![info exists treefilelist($id)]} {
75537553
if {![info exists treepending]} {
75547554
if {$id eq $nullid} {
@@ -7704,7 +7704,7 @@ proc startdiff {ids} {
77047704

77057705
settabs 1
77067706
set diffids $ids
7707-
catch {unset diffmergeid}
7707+
unset -nocomplain diffmergeid
77087708
if {![info exists treediffs($ids)] ||
77097709
[lsearch -exact $ids $nullid] >= 0 ||
77107710
[lsearch -exact $ids $nullid2] >= 0} {
@@ -8325,7 +8325,7 @@ proc clear_ctext {{first 1.0}} {
83258325
}
83268326
$ctext delete $first end
83278327
if {$first eq "1.0"} {
8328-
catch {unset pendinglinks}
8328+
unset -nocomplain pendinglinks
83298329
}
83308330
set ctext_file_names {}
83318331
set ctext_file_lines {}
@@ -8501,7 +8501,7 @@ proc scrolltext {f0 f1} {
85018501
highlightfile_for_scrollpos $topidx
85028502
}
85038503

8504-
catch {unset suppress_highlighting_file_for_this_scrollpos}
8504+
unset -nocomplain suppress_highlighting_file_for_this_scrollpos
85058505

85068506
.bleft.bottom.sb set $f0 $f1
85078507
if {$searchstring ne {}} {
@@ -10103,9 +10103,9 @@ proc getallclines {fd} {
1010310103
}
1010410104
if {$nid > 0} {
1010510105
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
1010910109
}
1011010110
if {![eof $fd]} {
1011110111
return [expr {$nid >= 1000? 2: 1}]
@@ -10345,7 +10345,7 @@ proc dropcache {err} {
1034510345
foreach v {arcnos arcout arcids arcstart arcend growing \
1034610346
arctags archeads allparents allchildren} {
1034710347
global $v
10348-
catch {unset $v}
10348+
unset -nocomplain $v
1034910349
}
1035010350
set allcwait 0
1035110351
set nextarc 0
@@ -10996,8 +10996,8 @@ proc addedtag {id} {
1099610996
if {![info exists arcout($id)]} {
1099710997
recalcarc [lindex $arcnos($id) 0]
1099810998
}
10999-
catch {unset cached_dtags}
11000-
catch {unset cached_atags}
10999+
unset -nocomplain cached_dtags
11000+
unset -nocomplain cached_atags
1100111001
}
1100211002

1100311003
proc addedhead {hid head} {
@@ -11007,13 +11007,13 @@ proc addedhead {hid head} {
1100711007
if {![info exists arcout($hid)]} {
1100811008
recalcarc [lindex $arcnos($hid) 0]
1100911009
}
11010-
catch {unset cached_dheads}
11010+
unset -nocomplain cached_dheads
1101111011
}
1101211012

1101311013
proc removedhead {hid head} {
1101411014
global cached_dheads
1101511015

11016-
catch {unset cached_dheads}
11016+
unset -nocomplain cached_dheads
1101711017
}
1101811018

1101911019
proc movedhead {hid head} {
@@ -11023,7 +11023,7 @@ proc movedhead {hid head} {
1102311023
if {![info exists arcout($hid)]} {
1102411024
recalcarc [lindex $arcnos($hid) 0]
1102511025
}
11026-
catch {unset cached_dheads}
11026+
unset -nocomplain cached_dheads
1102711027
}
1102811028

1102911029
proc changedrefs {} {
@@ -11039,10 +11039,10 @@ proc changedrefs {} {
1103911039
}
1104011040
}
1104111041
}
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
1104611046
}
1104711047

1104811048
proc rereadrefs {} {
@@ -11628,7 +11628,7 @@ proc prefsok {} {
1162811628
($perfile_attrs && !$oldprefs(perfile_attrs))} {
1162911629
# treediffs elements are limited by path;
1163011630
# won't have encodings cached if perfile_attrs was just turned on
11631-
catch {unset treediffs}
11631+
unset -nocomplain treediffs
1163211632
}
1163311633
if {$fontchanged || $maxwidth != $oldprefs(maxwidth)
1163411634
|| $maxgraphpct != $oldprefs(maxgraphpct)} {

0 commit comments

Comments
 (0)