From: Christian Couder <chriscool@tuxfamily.org>
To: Nanako Shiraishi <nanako3@lavabit.com>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
John Tapsell <johnflux@gmail.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Pierre Habouzit <madcoder@debian.org>
Subject: Re: [PATCH 1/7] strbuf: add "include_delim" parameter to "strbuf_split"
Date: Fri, 13 Mar 2009 05:48:30 +0100 [thread overview]
Message-ID: <200903130548.30370.chriscool@tuxfamily.org> (raw)
In-Reply-To: <20090312190846.6117@nanako3.lavabit.com>
Le jeudi 12 mars 2009, Nanako Shiraishi a écrit :
> Quoting Christian Couder <chriscool@tuxfamily.org>:
> > 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.
next prev parent reply other threads:[~2009-03-13 4:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-12 7:51 [PATCH 1/7] strbuf: add "include_delim" parameter to "strbuf_split" Christian Couder
[not found] ` <20090312190846.6117@nanako3.lavabit.com>
2009-03-13 4:48 ` Christian Couder [this message]
2009-03-13 5:17 ` Junio C Hamano
2009-03-13 6:02 ` Christian Couder
2009-03-13 6:53 ` Junio C Hamano
2009-03-14 7:46 ` Migrate bisect to C (was: [PATCH 1/7] strbuf: add "include_delim" parameter to "strbuf_split") Christian Couder
2009-03-14 8:16 ` Migrate bisect to C Junio C Hamano
2009-03-14 12:09 ` fetch--tool, was " Johannes Schindelin
2009-03-13 7:06 ` [PATCH 1/7] strbuf: add "include_delim" parameter to "strbuf_split" Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200903130548.30370.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johnflux@gmail.com \
--cc=madcoder@debian.org \
--cc=mingo@elte.hu \
--cc=nanako3@lavabit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).