]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Use descriptive names in esc_html_hl_regions()
authorMichał Kiedrowicz <redacted>
Wed, 11 Apr 2012 21:18:37 +0000 (23:18 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:32 +0000 (00:51 -0400)
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 <redacted>
Signed-off-by: Michał Kiedrowicz <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 144b9684ab71e5461d8641e11ffafec7d5c106d3303387ee865a983e26cc0973..e8f277c35014e650251461b9e1706750a37afdc0bb6a33f370c09531d1387518 100755 (executable)
@@ -1739,12 +1739,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));
This page took 0.179866 seconds and 4 git commands to generate.