All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Jerry Illikainen <hji@dyntopia.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2 1/1] gpg-interface: add minTrustLevel as a configuration option
Date: Fri, 27 Dec 2019 13:46:52 +0000	[thread overview]
Message-ID: <87r20pkhir.hji@dyntopia.com> (raw)
In-Reply-To: <xmqqblrx5yxu.fsf@gitster-ct.c.googlers.com>

On Tue, Dec 24 2019, Junio C Hamano wrote:
> Hans Jerry Illikainen <hji@dyntopia.com> writes:
>
>> +				/* Do we have trust level? */
>> +				if (sigcheck_gpg_status[i].flags & GPG_STATUS_TRUST_LEVEL) {
>> +					/*
>> +					 * GPG v1 and v2 differs in how the
>> +					 * TRUST_ lines are written.  Some
>> +					 * trust lines contain no additional
>> +					 * space-separated information for v1.
>> +					 */
>> +					next = strchr(line, ' ');
>> +					if (!next)
>> +						next = strchrnul(line, '\n');
>> +					trust = xmemdupz(line, next - line);
>
> I wonder if telling strcspn() to stop at either SP or LF is more in
> line with the existing codebase [*1*] and/or more readable.  It
> would make this part to:
>
> 		size_t trust_size = strcspn(line, " \n");
> 		trust = xmemdupz(line, trust_size);
>
> without the need to use or update the 'next' variable, if I am not
> mistaken?

I agree; fixed in v3.

> By the way, while we are looking at this patch, I notice that,
> throughout the function, the use of variable 'next' feels rather
> misleading, at least to me.
>
> [...]
>
> I wonder if the code becomes less misleading if we either (1)
> renamed 'next' to a name that hints more strongly that it is not the
> 'next' line but the end of the current token we are interested in,
> or (2) get rid of the pointer and instead counted size of the
> current token we are interested in, or perhaps both?  

Yeah the name 'next' does seem a bit counter-intuitive when used in
relation to 'line'.  Looking through the function it seems that both (1)
and (2) would work.

> This is not the fault of this patch, but I just mention it before I
> forget.
>
> Thanks.

Thanks for the review!

-- 
hji

  reply	other threads:[~2019-12-27 13:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 15:32 [PATCH 0/1] gpg-interface: add minTrustLevel as a configuration option Hans Jerry Illikainen
2019-12-16 15:32 ` [PATCH 1/1] " Hans Jerry Illikainen
2019-12-20 22:57   ` SZEDER Gábor
2019-12-21 18:59     ` Hans Jerry Illikainen
2019-12-23 14:50       ` Randall S. Becker
2019-12-24 11:30         ` Hans Jerry Illikainen
2019-12-24 14:20           ` Randall S. Becker
2019-12-16 20:58 ` [PATCH 0/1] " Junio C Hamano
2019-12-18 23:59   ` Hans Jerry Illikainen
2019-12-19  0:01 ` [PATCH v1 " Hans Jerry Illikainen
2019-12-19  0:01   ` [PATCH v1 1/1] " Hans Jerry Illikainen
2019-12-22  0:31   ` [PATCH v2 0/1] " Hans Jerry Illikainen
2019-12-22  0:31     ` [PATCH v2 1/1] " Hans Jerry Illikainen
2019-12-24 19:02       ` Junio C Hamano
2019-12-27 13:46         ` Hans Jerry Illikainen [this message]
2019-12-27 22:21           ` Junio C Hamano
2019-12-22  0:44     ` [PATCH v2 0/1] " Hans Jerry Illikainen
2019-12-27 13:55     ` [PATCH v3 " Hans Jerry Illikainen
2019-12-27 13:55       ` [PATCH v3 1/1] " Hans Jerry Illikainen

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=87r20pkhir.hji@dyntopia.com \
    --to=hji@dyntopia.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.