From: Luben Tuikov <ltuikov@yahoo.com>
To: git@vger.kernel.org
Subject: [PATCH] gitweb.cgi: git_blame2: slight optimization reading the blame lines
Date: Sun, 23 Jul 2006 14:17:48 -0700 (PDT) [thread overview]
Message-ID: <20060723211748.77065.qmail@web31814.mail.mud.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 223 bytes --]
Eliminate git_read_blame_line() -- move that code inline and
optimize it.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
gitweb/gitweb.cgi | 19 +++++--------------
1 files changed, 5 insertions(+), 14 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 2795696785-p1.patch --]
[-- Type: text/inline; name="p1.patch", Size: 1010 bytes --]
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 16340f2..7fbfc0d 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,13 +1293,12 @@ sub git_blame2 {
print "<div class=\"page_body\">\n";
print "<table class=\"blame\">\n";
print "<tr><th>Commit</th><th>Line</th><th>Data</th></tr>\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;
--
1.4.2.rc1.g9b54
reply other threads:[~2006-07-23 21:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060723211748.77065.qmail@web31814.mail.mud.yahoo.com \
--to=ltuikov@yahoo.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox