glib-aux: use nm_str_buf_append_c() in nm_str_buf_append_c_hex()

This commit is contained in:
Thomas Haller
2021-05-12 10:05:52 +02:00
parent 77fb782060
commit d784fdb9d9

View File

@@ -159,7 +159,7 @@ static inline void
nm_str_buf_append_c_repeated(NMStrBuf *strbuf, char ch, guint len) nm_str_buf_append_c_repeated(NMStrBuf *strbuf, char ch, guint len)
{ {
if (len > 0) { if (len > 0) {
nm_str_buf_maybe_expand(strbuf, len + 1, FALSE); nm_str_buf_maybe_expand(strbuf, ((gsize) len) + 1u, FALSE);
do { do {
strbuf->_priv_str[strbuf->_priv_len++] = ch; strbuf->_priv_str[strbuf->_priv_len++] = ch;
} while (--len > 0); } while (--len > 0);
@@ -202,9 +202,9 @@ _nm_str_buf_append_c_1(NMStrBuf *strbuf, char ch)
static inline void static inline void
nm_str_buf_append_c_hex(NMStrBuf *strbuf, char ch, gboolean upper_case) nm_str_buf_append_c_hex(NMStrBuf *strbuf, char ch, gboolean upper_case)
{ {
nm_str_buf_maybe_expand(strbuf, 3, FALSE); nm_str_buf_append_c(strbuf,
strbuf->_priv_str[strbuf->_priv_len++] = nm_hexchar(((guchar) ch) >> 4, upper_case); nm_hexchar(((guchar) ch) >> 4, upper_case),
strbuf->_priv_str[strbuf->_priv_len++] = nm_hexchar((guchar) ch, upper_case); nm_hexchar((guchar) ch, upper_case));
} }
static inline void static inline void