Skip to content

Commit ce61fb9

Browse files
mkiedrowiczgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Michał Kiedrowicz <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 455cf26 commit ce61fb9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

gitweb/gitweb.perl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,12 +1738,15 @@ sub esc_html_hl_regions {
17381738
my $pos = 0;
17391739

17401740
for my $s (@sel) {
1741-
$out .= esc_html(substr($str, $pos, $s->[0] - $pos))
1742-
if ($s->[0] - $pos > 0);
1743-
$out .= $cgi->span({-class => $css_class},
1744-
esc_html(substr($str, $s->[0], $s->[1] - $s->[0])));
1741+
my ($begin, $end) = @$s;
17451742

1746-
$pos = $s->[1];
1743+
my $escaped = esc_html(substr($str, $begin, $end - $begin));
1744+
1745+
$out .= esc_html(substr($str, $pos, $begin - $pos))
1746+
if ($begin - $pos > 0);
1747+
$out .= $cgi->span({-class => $css_class}, $escaped);
1748+
1749+
$pos = $end;
17471750
}
17481751
$out .= esc_html(substr($str, $pos))
17491752
if ($pos < length($str));

0 commit comments

Comments
 (0)