Re: [PATCH v2] gpg-interface: add function for converting trust level to string
- From
Jaydeep Das <jaydeepjd.8914@gmail.com>
- Date
- Jul 11, 2022, 03:51 UTC
- Message-ID
- <ac3f12de-a421-dfec-dd2c-e1aae2393515@gmail.com>
- In-Reply-To
- <CAPig+cScKabgrh80e5rqWX8cnNEgvxP9JyVJCu+afBOJk_yopg@mail.gmail.com>
On 7/10/22 11:14, Eric Sunshine wrote:
Show 21 quoted lines
> I also am not a fan of making the caller free the result, and thought
> of mentioning it but didn't know if the approach implemented by this
> patch was suggested by an earlier reviewer.
>
>
> Given the small, fixed number of trust levels, and if the list is
> unlikely to change much in the future, I might suggest simply
> initializing the fields at compile-time rather than on-demand at
> run-time:
>
> static struct {
> const char *key;
> const char *display_key;
> enum signature_trust_level value;
> } sigcheck_gpg_trust_level[] = {
> { "UNDEFINED", "undefined", TRUST_UNDEFINED },
> { "NEVER", "never", TRUST_NEVER },
> { "MARGINAL", "marginal", TRUST_MARGINAL },
> { "FULLY", "fully", TRUST_FULLY },
> { "ULTIMATE", "ultimate", TRUST_ULTIMATE },
> };Will do in next patch.
Thanks, Jaydeep