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?