shared: add nm_str_buf_append_c_repeated() helper

(cherry picked from commit a2142e884b)
This commit is contained in:
Thomas Haller 2020-06-22 21:25:17 +02:00
parent 3ed95f308f
commit 4c443ec269
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -166,6 +166,19 @@ nm_str_buf_erase (NMStrBuf *strbuf,
/*****************************************************************************/
static inline void
nm_str_buf_append_c_repeated (NMStrBuf *strbuf,
char ch,
guint len)
{
if (len > 0) {
nm_str_buf_maybe_expand (strbuf, len + 1, FALSE);
do {
strbuf->_priv_str[strbuf->_priv_len++] = ch;
} while (--len > 0);
}
}
static inline void
nm_str_buf_append_c (NMStrBuf *strbuf,
char ch)