shared: add nm_str_buf_append_required_delimiter()

This commit is contained in:
Thomas Haller 2020-06-21 12:11:24 +02:00
parent 85e27b1f9c
commit 5222f1b5ff
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -286,6 +286,19 @@ nm_str_buf_ensure_trailing_c (NMStrBuf *strbuf, char ch)
nm_str_buf_append_c (strbuf, ch);
}
static inline NMStrBuf *
nm_str_buf_append_required_delimiter (NMStrBuf *strbuf,
char delimiter)
{
_nm_str_buf_assert (strbuf);
/* appends the @delimiter if it is required (that is, if the
* string is not empty). */
if (strbuf->len > 0)
nm_str_buf_append_c (strbuf, delimiter);
return strbuf;
}
/*****************************************************************************/
static inline gboolean