X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/b1f17f168b91d709c0c0e62608de301a36f06da9..fb3655df:/shared.c diff --git a/shared.c b/shared.c index 1fa9c99..10be355 100644 --- a/shared.c +++ b/shared.c @@ -130,6 +130,12 @@ char *ensure_end(const char *str, char c) return result; } +void strbuf_ensure_end(struct strbuf *sb, char c) +{ + if (!sb->len || sb->buf[sb->len - 1] != c) + strbuf_addch(sb, c); +} + char *strlpart(char *txt, int maxlen) { char *result;