gitweb: Fix bugs in git_search_grep_body: it's length(), not len()
PATCH 1/1 gitweb: Fix bugs in git_search_grep_body: it's length(), not len()
Use int(<expr>/2) to get integer value for a substring length.
Signed-off-by Jakub Narebski <[email protected]>
---
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(-)
gitweb/gitweb.perl +1 -1
@@ -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);