git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitweb: Fix bugs in git_search_grep_body: it's length(), not len()

From
Jakub Narebski <jnareb@gmail.com>
Date
Feb 23, 2008, 21:37 UTC
Message-ID
<20080223213449.16213.42233.stgit@localhost.localdomain>
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);
Message 1 of 1 in “gitweb: Fix bugs in git_search_grep_body: it's length(), not len()”
  1. gitweb: Fix bugs in git_search_grep_body: it's length(), not len()Jakub Narebski, Feb 23, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.