Re: [PATCH 1/7] strbuf: add "include_delim" parameter to "strbuf_split"

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

 



Le jeudi 12 mars 2009, Nanako Shiraishi a écrit :
> Quoting Christian Couder <chriscool@xxxxxxxxxxxxx>:
> > The "strbuf_split" function used to include the delimiter character
> > at the end of the splited strbufs it produced.
> >
> > This behavior is not wanted in many cases, so this patch adds a new
> > "include_delim" parameter to the function to let us switch it on or
> > off as we want.
>
> Sorry, but I don't understand the above claim. You say "not wanted in
> many cases" but your patch updates the existing callers, all of which do
> want to include the delimiter.

In many programming languages, like Perl and Python for example, there is 
a "split" function that splits strings, and by default the resulting 
strings don't include the delimiter.

In Git there are only 2 existing callers and I think this function could be 
used a lot more if there was a way not to include the delimiter.

In my patch series I add one caller that don't want the delimiter so after 
my patch series there are already half as many callers that don't want the 
delimiter.

And by the way, when I mentored the GSoC sequencer project I suggested to 
Stephan to use strbuf_split, but we also had the problem that the delimiter 
was included.

> The patch would easily justify itself if it made the callers pass 0 to
> the function to decline the delimiter, and as the result it made the
> codepaths that use the result simpler. But I don't think that is what
> your patch does.

Yes, my patch does not do that, because I think including the delimiter is a 
special case of the more general and useful behavior of not including it.

Best regards,
Christian.
--
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]

  Powered by Linux