Re: [PATCH v3 1/8] gitweb: Use descriptive names in esc_html_hl_regions()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> wrote:

> Michał Kiedrowicz <michal.kiedrowicz@xxxxxxxxx> writes:
> 
> > The $s->[0] and $s->[1] variables look a bit cryptic.  Let's rename
> > them to $beg and $end so that it's clear what they do.
> 
> Why not $begin and $end?

For no special reason.  I just took the names that Jakub proposed in

	http://article.gmane.org/gmane.comp.version-control.git/193839/
> 
> >
> > Suggested-by: Jakub Narębski <jnareb@xxxxxxxxx>
> > Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@xxxxxxxxx>
> > ---
> >  gitweb/gitweb.perl |   10 ++++++----
> >  1 files changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> > index a8b5fad..a3754ff 100755
> > --- a/gitweb/gitweb.perl
> > +++ b/gitweb/gitweb.perl
> > @@ -1738,12 +1738,14 @@ 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);
> > +		my ($beg, $end) = @$s;
> > +
> > +		$out .= esc_html(substr($str, $pos, $beg - $pos))
> > +			if ($beg - $pos > 0);
> >  		$out .= $cgi->span({-class => $css_class},
> > -		                   esc_html(substr($str, $s->[0],
> > $s->[1] - $s->[0])));
> > +		                   esc_html(substr($str, $beg,
> > $end - $beg))); 
> > -		$pos = $s->[1];
> > +		$pos = $end;
> >  	}
> >  	$out .= esc_html(substr($str, $pos))
> >  		if ($pos < length($str));
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]