From ce61fb968f9b86f5d889eeb7b80da8ec3d6bfb9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kiedrowicz?= Date: Wed, 11 Apr 2012 23:18:37 +0200 Subject: gitweb: Use descriptive names in esc_html_hl_regions() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Michał Kiedrowicz Signed-off-by: Junio C Hamano 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)); -- cgit v0.10.2-6-g49f6