From 58f8be580039b0575b197b9573a1c92745d96d30 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Tue, 17 Jan 2017 20:25:09 +0100 Subject: New upstream version 1.5.90 --- shared/nm-utils/nm-shared-utils.h | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'shared/nm-utils/nm-shared-utils.h') 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__ */ -- cgit 1.3.0-6-gf8a5