diff options
| author | Michael Biebl <biebl@debian.org> | 2017-01-17 20:25:47 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2017-01-17 20:25:47 +0100 |
| commit | bed53db3e064450b56e23ec654f40a3bafe58815 (patch) | |
| tree | 314508d6c904b1224dab2070e0cfdd5a02d7dd89 /shared/nm-utils/nm-shared-utils.h | |
| parent | 7135a6e87c938139e3a5db121d62dcaa783345d1 (diff) | |
| parent | 58f8be580039b0575b197b9573a1c92745d96d30 (diff) | |
Merge tag 'upstream/1.5.90' into experimental
Upstream version 1.5.90
Diffstat (limited to 'shared/nm-utils/nm-shared-utils.h')
| -rw-r--r-- | shared/nm-utils/nm-shared-utils.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/shared/nm-utils/nm-shared-utils.h b/shared/nm-utils/nm-shared-utils.h index cfa8f994..5d8a3a86 100644 --- a/shared/nm-utils/nm-shared-utils.h +++ b/shared/nm-utils/nm-shared-utils.h @@ -22,14 +22,33 @@ #ifndef __NM_SHARED_UTILS_H__ #define __NM_SHARED_UTILS_H__ -/******************************************************************************/ +/*****************************************************************************/ + +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, ...) _nm_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); + +/*****************************************************************************/ gint64 _nm_utils_ascii_str_to_int64 (const char *str, guint base, gint64 min, gint64 max, gint64 fallback); gint _nm_utils_ascii_str_to_bool (const char *str, gint default_value); -/******************************************************************************/ +/*****************************************************************************/ /** * NMUtilsError: @@ -54,13 +73,13 @@ void nm_utils_error_set_cancelled (GError **error, gboolean nm_utils_error_is_cancelled (GError *error, gboolean consider_is_disposing); -/******************************************************************************/ +/*****************************************************************************/ gboolean nm_g_object_set_property (GObject *object, const gchar *property_name, const GValue *value, GError **error); -/******************************************************************************/ +/*****************************************************************************/ #endif /* __NM_SHARED_UTILS_H__ */ |