From: Christian Couder <christian.couder@gmail•com>
To: git@vger•kernel.org
Cc: Junio C Hamano <gitster@pobox•com>,
Patrick Steinhardt <ps@pks•im>, Elijah Newren <newren@gmail•com>,
Jeff King <peff@peff•net>,
"brian m . carlson" <sandals@crustytoothpaste•net>,
Johannes Schindelin <Johannes.Schindelin@gmx•de>,
Christian Couder <christian.couder@gmail•com>,
Christian Couder <chriscool@tuxfamily•org>
Subject: [PATCH v2 1/5] gpg-interface: simplify ssh fingerprint parsing
Date: Thu, 30 Oct 2025 13:33:28 +0100 [thread overview]
Message-ID: <20251030123332.3337684-2-christian.couder@gmail.com> (raw)
In-Reply-To: <20251030123332.3337684-1-christian.couder@gmail.com>
In "gpg-interface.c", the 'parse_ssh_output()' function takes a
'struct signature_check *sigc' argument and populates many members of
this 'sigc' using information parsed from 'sigc->output' which
contains the ouput of an `ssh-keygen -Y ...` command that was used to
verify an SSH signature.
When it populates 'sigc->fingerprint' though, it uses
`xstrdup(strstr(line, "key ") + 4)` while `strstr(line, "key ")` has
already been computed a few lines above and is already available in
the `key` variable.
Let's simplify this.
Signed-off-by: Christian Couder <chriscool@tuxfamily•org>
---
gpg-interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gpg-interface.c b/gpg-interface.c
index 2f4f0e32cb..91d1b58cb4 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -443,7 +443,7 @@ static void parse_ssh_output(struct signature_check *sigc)
key = strstr(line, "key ");
if (key) {
- sigc->fingerprint = xstrdup(strstr(line, "key ") + 4);
+ sigc->fingerprint = xstrdup(key + 4);
sigc->key = xstrdup(sigc->fingerprint);
} else {
/*
--
2.51.2.617.g2aaa867cd1
next prev parent reply other threads:[~2025-10-30 12:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 8:12 [PATCH 0/5] fast-export/import: cleanups and translation Christian Couder
2025-10-28 8:12 ` [PATCH 1/5] gpg-interface: simplify ssh fingerprint parsing Christian Couder
2025-10-28 16:45 ` Junio C Hamano
2025-10-28 8:12 ` [PATCH 2/5] gpg-interface: use left shift to define GPG_VERIFY_* Christian Couder
2025-10-28 8:12 ` [PATCH 3/5] fast-export: mark strings for translation Christian Couder
2025-10-28 13:43 ` Junio C Hamano
2025-10-29 14:29 ` Christian Couder
2025-10-29 16:12 ` Junio C Hamano
2025-10-30 12:39 ` Christian Couder
2025-10-28 8:12 ` [PATCH 4/5] fast-import: " Christian Couder
2025-10-28 16:46 ` Junio C Hamano
2025-10-28 8:12 ` [PATCH 5/5] gpg-interface: mark a string " Christian Couder
2025-10-30 12:33 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Christian Couder
2025-10-30 12:33 ` Christian Couder [this message]
2025-10-30 12:33 ` [PATCH v2 2/5] gpg-interface: use left shift to define GPG_VERIFY_* Christian Couder
2025-10-30 12:33 ` [PATCH v2 3/5] fast-export: mark strings for translation Christian Couder
2025-10-30 12:33 ` [PATCH v2 4/5] fast-import: " Christian Couder
2025-10-31 19:35 ` Elijah Newren
2025-10-30 12:33 ` [PATCH v2 5/5] gpg-interface: mark a string " Christian Couder
2025-10-30 18:14 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Junio C Hamano
2025-10-31 19:37 ` Elijah Newren
2025-11-01 15:16 ` Christian Couder
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=20251030123332.3337684-2-christian.couder@gmail.com \
--to=christian.couder@gmail$(echo .)com \
--cc=Johannes.Schindelin@gmx$(echo .)de \
--cc=chriscool@tuxfamily$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=newren@gmail$(echo .)com \
--cc=peff@peff$(echo .)net \
--cc=ps@pks$(echo .)im \
--cc=sandals@crustytoothpaste$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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