diff options
| author | Olamide Caleb Bello <belkid98@gmail.com> | 2025-10-23 11:13:47 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-10-23 09:26:12 -0700 |
| commit | 2ab72a16d9e3f1aca223f5da5aaf8b533d8fa35a (patch) | |
| tree | 4a0c324059d6dbdc80c0f8b9ea3101bf86e2aa42 /t/unit-tests/clar/example/example.c | |
| parent | bee1bdd5888aafd1a8d51df000170f18b6a299ac (diff) | |
gpg-interface: do not use misdesigned strbuf_split*()
In get_default_ssh_signing_key(), the default ssh signing key is
retrieved in `key_stdout` buf, which is then split using
strbuf_split_max() into up to two strbufs at a new line and the first
strbuf is returned as a `char *`and not a strbuf.
This makes the function lack the use of strbuf API as no edits are
performed on the split tokens.
Simplify the process of retrieving and returning the desired line by
using strchr() to isolate the line and xmemdupz() to return a copy of the
line. This removes the roundabout way of splitting the string into
strbufs, just to return the line.
Reported-by: Junio Hamano <gitster@pobox.com>
Helped-by: Christian Couder <christian.couder@gmail.com>
Helped-by: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Signed-off-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/unit-tests/clar/example/example.c')
0 files changed, 0 insertions, 0 deletions
