mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 12:34:55 +00:00
glib-aux: convert nmtst_assert_setting_verifies() to a macro
The macro has the advantage, that it preserves the file and line number from the caller.
This commit is contained in:
parent
9360ed9a7a
commit
81bfce7c47
|
@ -2566,20 +2566,21 @@ nmtst_assert_connection_unnormalizable(NMConnection *con,
|
|||
g_clear_error(&error);
|
||||
}
|
||||
|
||||
static inline void
|
||||
nmtst_assert_setting_verifies(NMSetting *setting)
|
||||
{
|
||||
/* assert that the setting verifies without an error */
|
||||
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
||||
g_assert(NM_IS_SETTING(setting));
|
||||
|
||||
success = nm_setting_verify(setting, NULL, &error);
|
||||
g_assert_no_error(error);
|
||||
g_assert(success);
|
||||
}
|
||||
#define nmtst_assert_setting_verifies(setting) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
NMSetting *_setting = NM_SETTING(setting); \
|
||||
GError *_error = NULL; \
|
||||
gboolean _success; \
|
||||
\
|
||||
/* assert that the setting verifies without an error */ \
|
||||
\
|
||||
g_assert(NM_IS_SETTING(_setting)); \
|
||||
\
|
||||
_success = nm_setting_verify(_setting, NULL, &_error); \
|
||||
nmtst_assert_success(_success, _error); \
|
||||
} \
|
||||
G_STMT_END
|
||||
|
||||
#if defined(__NM_SIMPLE_CONNECTION_H__) && NM_CHECK_VERSION(1, 10, 0) \
|
||||
&& (!defined(NM_VERSION_MAX_ALLOWED) || NM_VERSION_MAX_ALLOWED >= NM_VERSION_1_10)
|
||||
|
|
Loading…
Reference in a new issue