mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-18 15:28:31 +02:00
utils: add nm_utils_strbuf_init() macro
This commit is contained in:
parent
7f43e0a7b3
commit
eb80f69098
1 changed files with 13 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue