hgk: use switch instead of a less efficient if/elseif/if
authorAndrew Shadura <andrew@shadura.me>
Sun, 29 Mar 2015 19:15:04 +0200
changeset 24531 18ee81b37928
parent 24530 2ace3b77aaef
child 24532 f5de208a635c
hgk: use switch instead of a less efficient if/elseif/if
contrib/hgk
--- a/contrib/hgk	Sun Mar 29 19:12:08 2015 +0200
+++ b/contrib/hgk	Sun Mar 29 19:15:04 2015 +0200
@@ -375,25 +375,25 @@
 		set inhdr 0
 	    } else {
 		set tag [lindex $line 0]
-		if {$tag == "author"} {
+		switch -- $tag "author" {
 		    set x [expr {[llength $line] - 2}]
 		    set audate [lindex $line $x]
 		    set auname [join [lrange $line 1 [expr {$x - 1}]]]
-		} elseif {$tag == "committer"} {
+		} "committer" {
 		    set x [expr {[llength $line] - 2}]
 		    set comdate [lindex $line $x]
 		    set comname [join [lrange $line 1 [expr {$x - 1}]]]
-		} elseif {$tag == "revision"} {
+		} "revision" {
 		    set rev [lindex $line 1]
-        } elseif {$tag == "branch"} {
+		} "branch" {
 		    set branch [join [lrange $line 1 end]]
-        } elseif {$tag == "bookmark"} {
+		} "bookmark" {
 		    set bookmark [join [lrange $line 1 end]]
-        } elseif {$tag == "obsolete"} {
+		} "obsolete" {
 		    set obsolete($id) ""
-        } elseif {$tag == "phase"} {
+		} "phase" {
 		    set phase [lindex $line 1 end]
-        }
+		}
 	    }
 	} else {
 	    if {$comment == {}} {