From 3a54f28a4eab33e322ac526bf8fc74b78c1013ea Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 20 Apr 2022 10:32:14 +0100 Subject: [PATCH] Extra utility function add_to_commasep_pl. Just like add_to_commasep, but takes a ptrlen. --- ssh.h | 1 + ssh/common.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ssh.h b/ssh.h index fb86f4f0..690d55c7 100644 --- a/ssh.h +++ b/ssh.h @@ -1732,6 +1732,7 @@ unsigned alloc_channel_id_general(tree234 *channels, size_t localid_offset); alloc_channel_id_general(tree, offsetof(type, localid))) void add_to_commasep(strbuf *buf, const char *data); +void add_to_commasep_pl(strbuf *buf, ptrlen data); bool get_commasep_word(ptrlen *list, ptrlen *word); SeatPromptResult verify_ssh_host_key( diff --git a/ssh/common.c b/ssh/common.c index 0c9f51e3..424c8f71 100644 --- a/ssh/common.c +++ b/ssh/common.c @@ -607,11 +607,16 @@ unsigned alloc_channel_id_general(tree234 *channels, size_t localid_offset) * lists of protocol identifiers in SSH-2. */ -void add_to_commasep(strbuf *buf, const char *data) +void add_to_commasep_pl(strbuf *buf, ptrlen data) { if (buf->len > 0) put_byte(buf, ','); - put_data(buf, data, strlen(data)); + put_datapl(buf, data); +} + +void add_to_commasep(strbuf *buf, const char *data) +{ + add_to_commasep_pl(buf, ptrlen_from_asciz(data)); } bool get_commasep_word(ptrlen *list, ptrlen *word)