From: Jeff King <peff@peff.net>
To: Christian Couder <christian.couder@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Christian Couder <chriscool@tuxfamily.org>,
git <git@vger.kernel.org>, Johan Herland <johan@herland.net>,
Josh Triplett <josh@joshtriplett.org>,
Thomas Rast <tr@thomasrast.ch>,
Michael Haggerty <mhagger@alum.mit.edu>,
Dan Carpenter <dan.carpenter@oracle.com>,
Greg Kroah-Hartman <greg@kroah.com>,
Eric Sunshine <sunshine@sunshineco.com>,
Ramsay Jones <ramsay@ramsay1.demon.co.uk>,
Jonathan Nieder <jrnieder@gmail.com>,
Marc Branchaud <marcnarc@xiplink.com>
Subject: Re: [PATCH v14 01/11] trailer: add data structures and basic functions
Date: Wed, 17 Sep 2014 03:58:39 -0400 [thread overview]
Message-ID: <20140917075838.GA16200@peff.net> (raw)
In-Reply-To: <CAP8UFD3wi2KCZhDAF7vqMpb72DbLMbHNDiDGi0tFLW+vzsQqSA@mail.gmail.com>
On Tue, Sep 16, 2014 at 10:01:11AM +0200, Christian Couder wrote:
> On Mon, Sep 15, 2014 at 10:39 PM, Junio C Hamano <gitster@pobox.com> wrote:
> > Christian Couder <chriscool@tuxfamily.org> writes:
> >
> >> +/* Get the length of buf from its beginning until its last alphanumeric character */
> >
> > That makes it sound as if feeding "abc%de#f@" to the function returns
> > 3 for "abc", but
>
> For me the last alphanumeric character in "abc%de#f@" is "f", so it is
> the length from the beginning to "f" so it should return 8.
FWIW, I parsed the comment as you intended, but I do think it is a bit
unclear (especially given the name, as it is skipping over more than
just alnums). From reading the calling code, it looks like the intent is
to take a token string like "Signed-off-by:" and find that the ":" is
part of the ending punctuation, but that the "-" are retained as
internal punctuation.
Would it make sense as:
/*
* Return the length of the string not including any final
* punctuation. E.g., the input "Signed-off-by:" would return
* 13, stripping the trailing punctuation but retaining
* internal punctuation.
*/
int token_len_without_separator(const char *token)
...
The name is a bit clunky, but hopefully it is more clear what the point
is.
-Peff
next prev parent reply other threads:[~2014-09-17 7:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-15 5:31 [PATCH v14 00/11] Add interpret-trailers builtin Christian Couder
2014-09-15 5:31 ` [PATCH v14 01/11] trailer: add data structures and basic functions Christian Couder
2014-09-15 20:39 ` Junio C Hamano
2014-09-16 8:01 ` Christian Couder
2014-09-17 7:58 ` Jeff King [this message]
2014-09-17 8:26 ` Christian Couder
2014-09-15 5:31 ` [PATCH v14 02/11] trailer: process trailers from input message and arguments Christian Couder
2014-09-15 5:31 ` [PATCH v14 03/11] trailer: read and process config information Christian Couder
2014-09-15 5:31 ` [PATCH v14 04/11] trailer: process command line trailer arguments Christian Couder
2014-09-15 5:31 ` [PATCH v14 05/11] trailer: parse trailers from file or stdin Christian Couder
2014-09-15 5:31 ` [PATCH v14 06/11] trailer: put all the processing together and print Christian Couder
2014-09-15 5:31 ` [PATCH v14 07/11] trailer: add interpret-trailers command Christian Couder
2014-09-15 5:31 ` [PATCH v14 08/11] trailer: add tests for "git interpret-trailers" Christian Couder
2014-09-15 5:31 ` [PATCH v14 09/11] trailer: execute command from 'trailer.<name>.command' Christian Couder
2014-09-15 5:31 ` [PATCH v14 10/11] trailer: add tests for commands in config file Christian Couder
2014-09-15 5:31 ` [PATCH v14 11/11] Documentation: add documentation for 'git interpret-trailers' Christian Couder
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=20140917075838.GA16200@peff.net \
--to=peff@peff.net \
--cc=chriscool@tuxfamily.org \
--cc=christian.couder@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=greg@kroah.com \
--cc=johan@herland.net \
--cc=josh@joshtriplett.org \
--cc=jrnieder@gmail.com \
--cc=marcnarc@xiplink.com \
--cc=mhagger@alum.mit.edu \
--cc=ramsay@ramsay1.demon.co.uk \
--cc=sunshine@sunshineco.com \
--cc=tr@thomasrast.ch \
/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).