diff options
author | Thomas Haller <thaller@redhat.com> | 2020-06-22 21:25:17 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-06-22 21:33:59 +0200 |
commit | a2142e884b9090f5b5f42b55381a1f848c2426bb (patch) | |
tree | 3706778ec55f90fb4da76c629bf3d67d1ff824a6 | |
parent | c6809df4cdf2f909ffcd98e842447fca523f1c0b (diff) | |
download | NetworkManager-a2142e884b9090f5b5f42b55381a1f848c2426bb.tar.gz |
shared: add nm_str_buf_append_c_repeated() helper
-rw-r--r-- | shared/nm-glib-aux/nm-str-buf.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-str-buf.h b/shared/nm-glib-aux/nm-str-buf.h index b582e2c8a6..13af81c01d 100644 --- a/shared/nm-glib-aux/nm-str-buf.h +++ b/shared/nm-glib-aux/nm-str-buf.h @@ -167,6 +167,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) { |