git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH v2 01/12] commit.c: use strchrnul() to scan for one line
Date: Mon, 16 May 2016 16:41:57 -0700	[thread overview]
Message-ID: <CAPc5daXM9a=W2R6YE=4PSuHWKXoZs_-VT+48ajh3mq1RoqYncA@mail.gmail.com> (raw)
In-Reply-To: <CAGZ79kbeXCsCs35hva2FWUhOD2F37ZDrzupEZLGBVbqnMxPjXQ@mail.gmail.com>

On Mon, May 16, 2016 at 4:19 PM, Stefan Beller <sbeller@google.com> wrote:
>>         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.

You're right. With or without braces,

  eol = strchrnul(p + 2, '\n');

would be easier to understand (I do not know offhand if the value of p
matters after this part, as I am responding from GMail Web UI without
access to the wider context in the source, though).

  reply	other threads:[~2016-05-16 23:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16 21:05 [PATCH v2 00/12] revamping git_check_attr() API Junio C Hamano
2016-05-16 21:05 ` [PATCH v2 01/12] commit.c: use strchrnul() to scan for one line Junio C Hamano
2016-05-16 23:19   ` Stefan Beller
2016-05-16 23:41     ` Junio C Hamano [this message]
2016-05-16 23:46       ` Stefan Beller
2016-05-16 21:05 ` [PATCH v2 02/12] attr.c: " Junio C Hamano
2016-05-16 23:28   ` Stefan Beller
2016-05-16 23:45     ` Junio C Hamano
2016-05-16 21:05 ` [PATCH v2 03/12] attr.c: update a stale comment on "struct match_attr" Junio C Hamano
2016-05-16 23:34   ` Stefan Beller
2016-05-16 23:39     ` Junio C Hamano
2016-05-16 21:05 ` [PATCH v2 04/12] attr.c: explain the lack of attr-name syntax check in parse_attr() Junio C Hamano
2016-05-16 21:05 ` [PATCH v2 05/12] attr.c: complete a sentence in a comment Junio C Hamano
2016-05-16 21:05 ` [PATCH v2 06/12] attr.c: mark where #if DEBUG ends more clearly Junio C Hamano
2016-05-16 21:05 ` [PATCH v2 07/12] attr.c: simplify macroexpand_one() Junio C Hamano
2016-05-16 21:05 ` [PATCH v2 08/12] attr: rename function and struct related to checking attributes Junio C Hamano
2016-05-16 21:05 ` [PATCH v2 09/12] attr: (re)introduce git_check_attr() and struct git_attr_check Junio C Hamano
2016-05-17  4:19   ` Eric Sunshine
2016-05-17  5:06     ` Junio C Hamano
2016-05-16 21:05 ` [PATCH v2 10/12] attr: convert git_all_attrs() to use "struct git_attr_check" Junio C Hamano
2016-05-17 17:00   ` Junio C Hamano
2016-05-17 21:08     ` Junio C Hamano
2016-05-18 16:34       ` Stefan Beller
2016-05-16 21:05 ` [PATCH v2 11/12] attr: convert git_check_attrs() callers to use the new API Junio C Hamano
2016-05-16 21:05 ` [PATCH v2 12/12] attr: retire git_check_attrs() API Junio C Hamano
2016-05-18 16:51 ` [PATCH v2 00/12] revamping git_check_attr() API Stefan Beller
2016-05-18 18:36   ` 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='CAPc5daXM9a=W2R6YE=4PSuHWKXoZs_-VT+48ajh3mq1RoqYncA@mail.gmail.com' \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=sbeller@google.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).