diff options
author | Thomas Haller <thaller@redhat.com> | 2020-06-20 19:43:56 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-06-26 09:29:52 +0200 |
commit | 85e27b1f9c8b6977d2dd23982e9a869f2996ee04 (patch) | |
tree | dadae21b16f946e1dd8ac07cb75085520f81875d | |
parent | 069be33fbdc0a6f925795b9ac7bdc7712b9799ba (diff) | |
download | NetworkManager-85e27b1f9c8b6977d2dd23982e9a869f2996ee04.tar.gz |
shared: add nm_str_buf_append_c_hex() helper
-rw-r--r-- | shared/nm-glib-aux/nm-str-buf.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-str-buf.h b/shared/nm-glib-aux/nm-str-buf.h index a2253ae89a..a8cbc847e0 100644 --- a/shared/nm-glib-aux/nm-str-buf.h +++ b/shared/nm-glib-aux/nm-str-buf.h @@ -212,6 +212,16 @@ nm_str_buf_append_c4 (NMStrBuf *strbuf, } static inline void +nm_str_buf_append_c_hex (NMStrBuf *strbuf, + char ch, + gboolean upper_case) +{ + nm_str_buf_maybe_expand (strbuf, 3, FALSE); + strbuf->_priv_str[strbuf->_priv_len++] = nm_hexchar (((guchar) ch) >> 4, upper_case); + strbuf->_priv_str[strbuf->_priv_len++] = nm_hexchar ((guchar) ch, upper_case); +} + +static inline void nm_str_buf_append_len (NMStrBuf *strbuf, const char *str, gsize len) |