shared: add nm_utils_escaped_tokens_escape_strbuf*() helpers

This commit is contained in:
Thomas Haller 2020-06-21 12:14:43 +02:00
parent a5a5656582
commit d83908b6a1
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -301,6 +301,34 @@ nm_str_buf_append_required_delimiter (NMStrBuf *strbuf,
/*****************************************************************************/
/* Calls nm_utils_escaped_tokens_escape() on @str and appends the
* result to @strbuf. */
static inline void
nm_utils_escaped_tokens_escape_strbuf (const char *str,
const char *delimiters,
NMStrBuf *strbuf)
{
gs_free char *str_to_free = NULL;
nm_assert (str);
nm_str_buf_append (strbuf,
nm_utils_escaped_tokens_escape (str, delimiters, &str_to_free));
}
/* Calls nm_utils_escaped_tokens_escape_unnecessary() on @str and appends the
* string to @strbuf. */
static inline void
nm_utils_escaped_tokens_escape_strbuf_assert (const char *str,
const char *delimiters,
NMStrBuf *strbuf)
{
nm_str_buf_append (strbuf,
nm_utils_escaped_tokens_escape_unnecessary (str, delimiters));
}
/*****************************************************************************/
static inline gboolean
nm_str_buf_is_initalized (NMStrBuf *strbuf)
{