Commit eb80f690 authored by Thomas Haller's avatar Thomas Haller Committed by Beniamino Galvani

utils: add nm_utils_strbuf_init() macro

parent 7f43e0a7
......@@ -301,6 +301,19 @@ fcn_name (lookup_type val) \
/*****************************************************************************/
static inline void
_nm_utils_strbuf_init (char *buf, gsize len, char **p_buf_ptr, gsize *p_buf_len)
{
NM_SET_OUT (p_buf_len, len);
NM_SET_OUT (p_buf_ptr, buf);
buf[0] = '\0';
}
#define nm_utils_strbuf_init(buf, p_buf_ptr, p_buf_len) \
G_STMT_START { \
G_STATIC_ASSERT (G_N_ELEMENTS (buf) == sizeof (buf) && sizeof (buf) > sizeof (char *)); \
_nm_utils_strbuf_init ((buf), sizeof (buf), (p_buf_ptr), (p_buf_len)); \
} G_STMT_END
void nm_utils_strbuf_append (char **buf, gsize *len, const char *format, ...) __attribute__((__format__ (__printf__, 3, 4)));
void nm_utils_strbuf_append_c (char **buf, gsize *len, char c);
void nm_utils_strbuf_append_str (char **buf, gsize *len, const char *str);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment