1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-26 01:16:36 +02:00

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>
This commit is contained in:
Michał Kiedrowicz 2012-04-11 23:18:37 +02:00 committed by Junio C Hamano
parent 455cf268db
commit ce61fb968f

View File

@ -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));