All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Max Horn <max@quendi.de>
Cc: Tanay Abhra <tanayabh@gmail.com>,
	git@vger.kernel.org, mhagger@alum.mit.edu
Subject: Re: [PATCH v3] commit.c: use skip_prefix() instead of starts_with()
Date: Tue, 04 Mar 2014 12:38:32 -0800	[thread overview]
Message-ID: <xmqqha7dk8c7.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <8CB399B0-6781-4702-9EC5-0D0A0CCC3450@quendi.de> (Max Horn's message of "Tue, 4 Mar 2014 20:16:47 +0100")

Max Horn <max@quendi.de> writes:

>> +		buf = ident_line;
>> 		if (split_ident_line(&ident,
>> -				     buf + strlen("author "),
>> -				     line_end - (buf + strlen("author "))) ||
>> +				     buf,
>> +				     line_end - buf) ||
>> 		    !ident.date_begin || !ident.date_end)
>> 			goto fail_exit; /* malformed "author" line */
>> 		break;
>
> Why not get rid of that assignment to "buf", and use ident_line
> instead of buf below? That seems like it would be more readable,
> wouldn't it?

Yes, and also now the argument list is much shorter, you could
probably do it on two lines instead of three:

                if (split_ident_line(&ident,
                                     ident_line, line_end - ident_line) ||
                    ...


>> @@ -1193,10 +1195,9 @@ static void parse_gpg_output(struct signature_check *sigc)
>> 	for (i = 0; i < ARRAY_SIZE(sigcheck_gpg_status); i++) {
>> 		const char *found, *next;
>> 
>> -		if (starts_with(buf, sigcheck_gpg_status[i].check + 1)) {
>> -			/* At the very beginning of the buffer */
>> -			found = buf + strlen(sigcheck_gpg_status[i].check + 1);
>> -		} else {
>> +		found = skip_prefix(buf, sigcheck_gpg_status[i].check + 1);
>> +		/* At the very beginning of the buffer */
>
> Do we really need that comment, and in that spot? The code seemed
> clear enough to me without it. But if you think keeping is better,
> perhaps move it to *before* the skip_prefix, and add a trailing
> "?"

Both good suggestions (I tend to prefer the removal).

Thanks.

  reply	other threads:[~2014-03-04 20:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04  8:42 [PATCH v3] commit.c: use skip_prefix() instead of starts_with() Tanay Abhra
2014-03-04 19:16 ` Max Horn
2014-03-04 20:38   ` Junio C Hamano [this message]
2014-03-04 19:33 ` 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=xmqqha7dk8c7.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=max@quendi.de \
    --cc=mhagger@alum.mit.edu \
    --cc=tanayabh@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.