gitk: Get rid of the childlist variable
The information in childlist is a duplicate of what's in the children array, and it wasn't being accessed often enough to be really worth keeping the list around as well. Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
Jun 18, 2007 at 09:48 UTC
6a90bff1e83bb25898ead28d7d3f426dfdfdbe71
1 file changed
+17
-29
gitk
+17
-29
@@ -139,8 +139,8 @@ proc getcommitlines {fd view} {
139
global commitlisted
140
global leftover commfd
141
global displayorder commitidx commitrow commitdata
142
- global parentlist childlist children curview hlview
143
- global vparentlist vchildlist vdisporder vcmitlisted
142
+ global parentlist children curview hlview
143
+ global vparentlist vdisporder vcmitlisted
144
145
set stuff [read $fd 500000]
146
if {$stuff == {}} {
@@ -237,12 +237,10 @@ proc getcommitlines {fd view} {
237
incr commitidx($view)
238
if {$view == $curview} {
239
lappend parentlist $olds
240
- lappend childlist $children($view,$id)
240
lappend displayorder $id
241
lappend commitlisted $listed
242
} else {
243
lappend vparentlist($view) $olds
245
- lappend vchildlist($view) $children($view,$id)
244
lappend vdisporder($view) $id
245
lappend vcmitlisted($view) $listed
246
}
@@ -1754,7 +1752,7 @@ proc unflatten {var l} {
1752
1753
proc showview {n} {
1754
global curview viewdata viewfiles
1757
- global displayorder parentlist childlist rowidlist rowoffsets
1755
+ global displayorder parentlist rowidlist rowoffsets
1756
global colormap rowtextx commitrow nextcolor canvxmax
1757
global numcommits rowrangelist commitlisted idrowranges rowchk
1758
global selectedline currentid canv canvy0
@@ -1763,7 +1761,7 @@ proc showview {n} {
1761
global commitidx rowlaidout rowoptim
1762
global commfd
1763
global selectedview selectfirst
1766
- global vparentlist vchildlist vdisporder vcmitlisted
1764
+ global vparentlist vdisporder vcmitlisted
1765
global hlview selectedhlview
1766
1767
if {$n == $curview} return
@@ -1789,7 +1787,6 @@ proc showview {n} {
1787
stopfindproc
1788
if {$curview >= 0} {
1789
set vparentlist($curview) $parentlist
1792
- set vchildlist($curview) $childlist
1790
set vdisporder($curview) $displayorder
1791
set vcmitlisted($curview) $commitlisted
1792
if {$phase ne {}} {
@@ -1828,7 +1825,6 @@ proc showview {n} {
1825
set phase [lindex $v 0]
1826
set displayorder $vdisporder($n)
1827
set parentlist $vparentlist($n)
1831
- set childlist $vchildlist($n)
1828
set commitlisted $vcmitlisted($n)
1829
set rowidlist [lindex $v 1]
1830
set rowoffsets [lindex $v 2]
@@ -1961,7 +1957,6 @@ proc addvhighlight {n} {
1957
if {$n != $curview && ![info exists viewdata($n)]} {
1958
set viewdata($n) [list getcommits {{}} {{}} {} {} {} 0 0 0 {}]
1959
set vparentlist($n) {}
1964
- set vchildlist($n) {}
1960
set vdisporder($n) {}
1961
set vcmitlisted($n) {}
1962
start_rev_list $n
@@ -2430,17 +2425,15 @@ proc ntimes {n o} {
2425
}
2426
2427
proc usedinrange {id l1 l2} {
2433
- global children commitrow childlist curview
2428
+ global children commitrow curview
2429
2430
if {[info exists commitrow($curview,$id)]} {
2431
set r $commitrow($curview,$id)
2432
if {$l1 <= $r && $r <= $l2} {
2433
return [expr {$r - $l1 + 1}]
2434
}
2440
- set kids [lindex $childlist $r]
2441
- } else {
2442
- set kids $children($curview,$id)
2435
}
2436
+ set kids $children($curview,$id)
2437
foreach c $kids {
2438
set r $commitrow($curview,$c)
2439
if {$l1 <= $r && $r <= $l2} {
@@ -2515,7 +2508,7 @@ proc initlayout {} {
2508
global idinlist rowchk rowrangelist idrowranges
2509
global numcommits canvxmax canv
2510
global nextcolor
2518
- global parentlist childlist children
2511
+ global parentlist
2512
global colormap rowtextx
2513
global selectfirst
2514
@@ -2523,7 +2516,6 @@ proc initlayout {} {
2516
set displayorder {}
2517
set commitlisted {}
2518
set parentlist {}
2526
- set childlist {}
2519
set rowrangelist {}
2520
set nextcolor 0
2521
set rowidlist {{}}
@@ -2721,7 +2713,7 @@ proc readdiffindex {fd serial} {
2713
proc layoutrows {row endrow last} {
2714
global rowidlist rowoffsets displayorder
2715
global uparrowlen downarrowlen maxwidth mingaplen
2724
- global childlist parentlist
2716
+ global children parentlist
2717
global idrowranges
2718
global commitidx curview
2719
global idinlist rowchk rowrangelist
@@ -2771,7 +2763,7 @@ proc layoutrows {row endrow last} {
2763
lappend idlist $id
2764
lset rowidlist $row $idlist
2765
set z {}
2774
- if {[lindex $childlist $row] ne {}} {
2766
+ if {$children($curview,$id) ne {}} {
2767
set z [expr {[llength [lindex $rowidlist [expr {$row-1}]]] - $col}]
2768
unset idinlist($id)
2769
}
@@ -2830,7 +2822,7 @@ proc layoutrows {row endrow last} {
2822
proc addextraid {id row} {
2823
global displayorder commitrow commitinfo
2824
global commitidx commitlisted
2833
- global parentlist childlist children curview
2825
+ global parentlist children curview
2826
2827
incr commitidx($curview)
2828
lappend displayorder $id
@@ -2844,7 +2836,6 @@ proc addextraid {id row} {
2836
if {![info exists children($curview,$id)]} {
2837
set children($curview,$id) {}
2838
}
2847
- lappend childlist $children($curview,$id)
2839
}
2840
2841
proc layouttail {} {
@@ -3729,7 +3720,7 @@ proc show_status {msg} {
3720
# The new commit will be displayed on row $row and the commits
3721
# on that row and below will move down one row.
3722
proc insertrow {row newcmit} {
3732
- global displayorder parentlist childlist commitlisted children
3723
+ global displayorder parentlist commitlisted children
3724
global commitrow curview rowidlist rowoffsets numcommits
3725
global rowrangelist rowlaidout rowoptim numcommits
3726
global selectedline rowchk commitidx
@@ -3741,11 +3732,10 @@ proc insertrow {row newcmit} {
3732
set p [lindex $displayorder $row]
3733
set displayorder [linsert $displayorder $row $newcmit]
3734
set parentlist [linsert $parentlist $row $p]
3744
- set kids [lindex $childlist $row]
3735
+ set kids $children($curview,$p)
3736
lappend kids $newcmit
3746
- lset childlist $row $kids
3747
- set childlist [linsert $childlist $row {}]
3737
set children($curview,$p) $kids
3738
+ set children($curview,$newcmit) {}
3739
set commitlisted [linsert $commitlisted $row 1]
3740
set l [llength $displayorder]
3741
for {set r $row} {$r < $l} {incr r} {
@@ -3802,7 +3792,7 @@ proc insertrow {row newcmit} {
3792
3793
# Remove a commit that was inserted with insertrow on row $row.
3794
proc removerow {row} {
3805
- global displayorder parentlist childlist commitlisted children
3795
+ global displayorder parentlist commitlisted children
3796
global commitrow curview rowidlist rowoffsets numcommits
3797
global rowrangelist idrowranges rowlaidout rowoptim numcommits
3798
global linesegends selectedline rowchk commitidx
@@ -3816,13 +3806,11 @@ proc removerow {row} {
3806
set p [lindex $parentlist $row]
3807
set displayorder [lreplace $displayorder $row $row]
3808
set parentlist [lreplace $parentlist $row $row]
3819
- set childlist [lreplace $childlist $row $row]
3809
set commitlisted [lreplace $commitlisted $row $row]
3821
- set kids [lindex $childlist $row]
3810
+ set kids $children($curview,$p)
3811
set i [lsearch -exact $kids $id]
3812
if {$i >= 0} {
3813
set kids [lreplace $kids $i $i]
3825
- lset childlist $row $kids
3814
set children($curview,$p) $kids
3815
}
3816
set l [llength $displayorder]
@@ -4264,7 +4252,7 @@ proc dispnexttag {} {
4252
proc selectline {l isnew} {
4253
global canv canv2 canv3 ctext commitinfo selectedline
4254
global displayorder linehtag linentag linedtag
4267
- global canvy0 linespc parentlist childlist
4255
+ global canvy0 linespc parentlist children curview
4256
global currentid sha1entry
4257
global commentend idtags linknum
4258
global mergemax numcommits pending_select
@@ -4375,7 +4363,7 @@ proc selectline {l isnew} {
4363
}
4364
}
4365
4378
- foreach c [lindex $childlist $l] {
4366
+ foreach c $children($curview,$id) {
4367
append headers "Child: [commit_descriptor $c]"
4368
}
4369