From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Cc: Jean-Baptiste Quenot <jbq@caraldi.com>,
Jakub Narebski <jnareb@gmail.com>
Subject: [PATCH] gitweb: Fix bugs in git_search_grep_body: it's length(), not len()
Date: Sat, 23 Feb 2008 22:37:08 +0100 [thread overview]
Message-ID: <20080223213449.16213.42233.stgit@localhost.localdomain> (raw)
Use int(<expr>/2) to get integer value for a substring length.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
I'm very very sorry. I though I have tested this, but somehow it
slipped through; most probably I have tested older version.
gitweb/gitweb.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 326e27c..e8226b1 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3792,7 +3792,7 @@ sub git_search_grep_body {
if ($line =~ m/^(.*)($search_regexp)(.*)$/i) {
my ($lead, $match, $trail) = ($1, $2, $3);
$match = chop_str($match, 70, 5); # in case match is very long
- my $contextlen = (80 - len($match))/2; # is left for the remainder
+ my $contextlen = int((80 - length($match))/2); # for the remainder
$contextlen = 30 if ($contextlen > 30); # but not too much
$lead = chop_str($lead, $contextlen, 10);
$trail = chop_str($trail, $contextlen, 10);
reply other threads:[~2008-02-23 21:37 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=20080223213449.16213.42233.stgit@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jbq@caraldi.com \
/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;
as well as URLs for NNTP newsgroup(s).