gitweb: Use descriptive names in esc_html_hl_regions()
authorMichał Kiedrowicz <michal.kiedrowicz@gmail.com>
Wed, 11 Apr 2012 21:18:37 +0000 (23:18 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Apr 2012 21:26:01 +0000 (14:26 -0700)
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>
gitweb/gitweb.perl

index a8b5fad26631207fcc17a6339ba735877c0902bd..1c5430158207bf4b549bd7b95789f70ee0c0a6e0 100755 (executable)
@@ -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));