Re: [PATCH v2 01/12] commit.c: use strchrnul() to scan for one line
- From
Stefan Beller <sbeller@google.com>
- Date
- May 16, 2016, 23:19 UTC
- Message-ID
- <CAGZ79kbeXCsCs35hva2FWUhOD2F37ZDrzupEZLGBVbqnMxPjXQ@mail.gmail.com>
- In-Reply-To
- <20160516210545.6591-2-gitster@pobox.com>
On Mon, May 16, 2016 at 2:05 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> commit.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/commit.c b/commit.c
> index 3f4f371..1f9ee8a 100644
> --- a/commit.c
> +++ b/commit.c
> @@ -415,8 +415,7 @@ int find_commit_subject(const char *commit_buffer, const char **subject)
> p++;
> if (*p) {
> p += 2;
> - for (eol = p; *eol && *eol != '\n'; eol++)
> - ; /* do nothing */
> + eol = strchrnul(p, '\n');Nit: You could include the +2 into the arg of strchrnul, such that you can drop the braces.
Show 10 quoted lines
> } else > eol = p; > > -- > 2.8.2-748-gfb85f76 > > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html