git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v14 01/11] trailer: add data structures and basic functions

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 15, 2014, 20:39 UTC
Message-ID
<xmqqsijs4o02.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140915053142.26573.86374.chriscool@tuxfamily.org>
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

Show 6 quoted lines
> +static size_t alnum_len(const char *buf, size_t len)
> +{
> +	while (len > 0 && !isalnum(buf[len - 1]))
> +		len--;
> +	return len;
> +}

doesn't it look at '@', be unhappy and decrement, look at 'f' and break out to return the length of "abc%de#f"?

Perhaps that behaviour _is_ what you want, but then the comment is lying, no?

Previous: Christian CouderNext: Christian Couder
Message 3 of 16 in “Add interpret-trailers builtin”
  1. 00/11 Add interpret-trailers builtinChristian Couder, Sep 15, 2014
  2. 01/11 trailer: add data structures and basic functionsChristian Couder, Sep 15, 2014
  3. Junio C HamanoSep 15, 2014
  4. Christian CouderSep 16, 2014
  5. Jeff KingSep 17, 2014
  6. Christian CouderSep 17, 2014
  7. 02/11 trailer: process trailers from input message and argumentsChristian Couder, Sep 15, 2014
  8. 03/11 trailer: read and process config informationChristian Couder, Sep 15, 2014
  9. 04/11 trailer: process command line trailer argumentsChristian Couder, Sep 15, 2014
  10. 05/11 trailer: parse trailers from file or stdinChristian Couder, Sep 15, 2014
  11. 06/11 trailer: put all the processing together and printChristian Couder, Sep 15, 2014
  12. 07/11 trailer: add interpret-trailers commandChristian Couder, Sep 15, 2014
  13. 08/11 trailer: add tests for "git interpret-trailers"Christian Couder, Sep 15, 2014
  14. 09/11 trailer: execute command from 'trailer.<name>.command'Christian Couder, Sep 15, 2014
  15. 10/11 trailer: add tests for commands in config fileChristian Couder, Sep 15, 2014
  16. 11/11 Documentation: add documentation for 'git interpret-trailers'Christian Couder, Sep 15, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.