@matheusbsbs / matheus-bagliano / commits / 9d561ad324
Fork 0

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 <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jakub Narebski committed Feb 23, 2008 at 22:37 UTC 9d561ad324fc8942919981f2c80360e22896989c
1 file changed +1 -1
gitweb/gitweb.perl
+1 -1
@@ -3792,7 +3792,7 @@ sub git_search_grep_body {
3792 if ($line =~ m/^(.*)($search_regexp)(.*)$/i) {
3793 my ($lead, $match, $trail) = ($1, $2, $3);
3794 $match = chop_str($match, 70, 5); # in case match is very long
3795 - my $contextlen = (80 - len($match))/2; # is left for the remainder
3795 + my $contextlen = int((80 - length($match))/2); # for the remainder
3796 $contextlen = 30 if ($contextlen > 30); # but not too much
3797 $lead = chop_str($lead, $contextlen, 10);
3798 $trail = chop_str($trail, $contextlen, 10);