From: Eric Sunshine <sunshine@sunshineco.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jaydeep Das via GitGitGadget <gitgitgadget@gmail.com>,
Git List <git@vger.kernel.org>,
Jaydeep Das <jaydeepjd.8914@gmail.com>
Subject: Re: [PATCH v2] gpg-interface: add function for converting trust level to string
Date: Sun, 10 Jul 2022 02:21:16 -0400 [thread overview]
Message-ID: <CAPig+cSqBARuXgcr3W4_1fEb_d4srXCkW=Ur20VV2jyT9sVNkA@mail.gmail.com> (raw)
In-Reply-To: <xmqqilo5sel6.fsf@gitster.g>
On Sun, Jul 10, 2022 at 1:48 AM Junio C Hamano <gitster@pobox.com> wrote:
> Eric Sunshine <sunshine@sunshineco.com> writes:
> > 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 },
> > };
>
> Yup, that is even better. I wonder if we can upcase in C
> preprocessor macro? It would be wonderful if we can do so,
> but for just 5 entries, we can type each token three times
> just fine.
No standardized way to upcase via the C preprocessor, as far as I
know. At any rate, I suspect such a macro would be uglier and harder
to reason about than the code above, which is dead-simple to
understand.
next prev parent reply other threads:[~2022-07-10 6:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-07 13:57 [PATCH] gpg-interface: add function for converting trust level to string Jaydeep Das via GitGitGadget
2022-07-07 18:18 ` Junio C Hamano
2022-07-08 11:24 ` [PATCH v2] " Jaydeep Das via GitGitGadget
2022-07-09 0:58 ` Eric Sunshine
2022-07-09 3:51 ` jaydeepjd.8914
2022-07-09 20:52 ` Junio C Hamano
2022-07-10 5:44 ` Eric Sunshine
2022-07-10 5:48 ` Junio C Hamano
2022-07-10 6:21 ` Eric Sunshine [this message]
2022-07-11 3:51 ` Jaydeep Das
2022-07-09 4:43 ` [PATCH v3] " Jaydeep Das via GitGitGadget
2022-07-11 5:00 ` [PATCH v4] " Jaydeep Das via GitGitGadget
2022-07-11 5:12 ` 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPig+cSqBARuXgcr3W4_1fEb_d4srXCkW=Ur20VV2jyT9sVNkA@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=jaydeepjd.8914@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).