Re: [PATCH v5 01/16] Git.pm: add subroutines for commenting lines

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

 



Jakub Narębski <jnareb@xxxxxxxxx> writes:

>> I prefer to have like this instead
>> 
>> sub prefix_lines {
>>         my $prefix = shift;
>>         my $string = join("\n", @_);
>>         $string =~ s/^/$prefix/mg;
>>         return $string;
>> }
>> 
>> So both subroutines can take several strings as arguments.
>
> I like the interface, but the implementation looks a bit inefficient.
> Why not simply:
> ...
> If those strings can contain embedded newlines (so that they can be
> called as in Junio example), then your solution is a must-be
>
>   sub prefix_lines {
>           my $prefix = shift;
>           my $string = join("\n", @_);
>           $string =~ s/^/$prefix/mg;
>           return $string;
>   }
>
> Well, nevermind then

OK, so in short, is that a "Reviewed-by:" from you ;-)?

I agree with the conclusion.  Thanks for a review.





[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]