summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorMichał Kiedrowicz <michal.kiedrowicz@gmail.com>2012-04-11 21:18:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-04-11 21:26:01 (GMT)
commitce61fb968f9b86f5d889eeb7b80da8ec3d6bfb9b (patch)
tree33584d7533684f3d4eacbd8a0f2b6c9b6d9966a2 /gitweb
parent455cf268dbaf227bdbd5e9fbf96525452bcfe44f (diff)
downloadgit-ce61fb968f9b86f5d889eeb7b80da8ec3d6bfb9b.zip
git-ce61fb968f9b86f5d889eeb7b80da8ec3d6bfb9b.tar.gz
git-ce61fb968f9b86f5d889eeb7b80da8ec3d6bfb9b.tar.bz2
gitweb: Use descriptive names in esc_html_hl_regions()
The $s->[0] and $s->[1] variables look a bit cryptic. Let's rename them to $begin and $end so that it's clear what they do. Suggested-by: Jakub Narębski <jnareb@gmail.com> Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb')
-rwxr-xr-xgitweb/gitweb.perl13
1 files changed, 8 insertions, 5 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a8b5fad..1c54301 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1738,12 +1738,15 @@ sub esc_html_hl_regions {
my $pos = 0;
for my $s (@sel) {
- $out .= esc_html(substr($str, $pos, $s->[0] - $pos))
- if ($s->[0] - $pos > 0);
- $out .= $cgi->span({-class => $css_class},
- esc_html(substr($str, $s->[0], $s->[1] - $s->[0])));
+ my ($begin, $end) = @$s;
- $pos = $s->[1];
+ my $escaped = esc_html(substr($str, $begin, $end - $begin));
+
+ $out .= esc_html(substr($str, $pos, $begin - $pos))
+ if ($begin - $pos > 0);
+ $out .= $cgi->span({-class => $css_class}, $escaped);
+
+ $pos = $end;
}
$out .= esc_html(substr($str, $pos))
if ($pos < length($str));