From acb0f6f33760b43c1fc9617a45346ab3738f021a Mon Sep 17 00:00:00 2001 From: Luben Tuikov Date: Sun, 23 Jul 2006 14:17:48 -0700 Subject: gitweb.cgi: git_blame2: slight optimization reading the blame lines Eliminate git_read_blame_line() -- move that code inline and optimize it. Signed-off-by: Luben Tuikov Signed-off-by: Junio C Hamano --- gitweb/gitweb.cgi | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'gitweb/gitweb.cgi') diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi index 16340f210..7fbfc0d22 100755 --- a/gitweb/gitweb.cgi +++ b/gitweb/gitweb.cgi @@ -1252,15 +1252,6 @@ sub git_tag { git_footer_html(); } -sub git_read_blame_line { - my %bl; - $_ = shift; - - ($bl{'hash'}, $bl{'lineno'}, $bl{'data'}) = /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/; - - return %bl; -} - sub git_blame2 { my $fd; my $ftype; @@ -1302,12 +1293,12 @@ sub git_blame2 { print "
\n"; print "\n"; print "\n"; - while (my $line = <$fd>) { - my %blame_line = git_read_blame_line($line); - my $full_rev = $blame_line{'hash'}; + while (<$fd>) { + /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/; + my $full_rev = $1; my $rev = substr($full_rev, 0, 8); - my $lineno = $blame_line{'lineno'}; - my $data = $blame_line{'data'}; + my $lineno = $2; + my $data = $3; if (!defined $last_rev) { $last_rev = $full_rev; -- cgit v1.2.1
CommitLineData