summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-06-01 14:31:25 +0200
committerThomas Haller <thaller@redhat.com>2017-06-07 09:07:17 +0200
commit1d6b717401e42f3cc96e08e7e7ca807e90f73135 (patch)
tree769cc0f42e079e5f633490ddea9c762388d8bc6f
parent837a8c1ca5bd3ec391d228c6a5725c85bc4a1c55 (diff)
downloadNetworkManager-1d6b717401e42f3cc96e08e7e7ca807e90f73135.tar.gz
libnm: downgrade assertions in _nm_register_setting_impl() to nm_assert()
This is entirely internal API. We have unit tests that execute these code paths. No need to have these assertions in production code.
-rw-r--r--libnm-core/nm-setting.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c
index a574449f58..16e987cae4 100644
--- a/libnm-core/nm-setting.c
+++ b/libnm-core/nm-setting.c
@@ -132,22 +132,17 @@ _nm_register_setting_impl (const char *name,
{
SettingInfo *info;
- g_return_if_fail (name != NULL && *name);
- g_return_if_fail (type != G_TYPE_INVALID);
- g_return_if_fail (type != G_TYPE_NONE);
+ nm_assert (name && *name);
+ nm_assert (!NM_IN_SET (type, G_TYPE_INVALID, G_TYPE_NONE));
+ nm_assert (priority != NM_SETTING_PRIORITY_INVALID);
_ensure_registered ();
- if (G_LIKELY ((info = g_hash_table_lookup (registered_settings, name)))) {
- g_return_if_fail (info->type == type);
- g_return_if_fail (info->priority == priority);
- g_return_if_fail (g_strcmp0 (info->name, name) == 0);
- return;
- }
- g_return_if_fail (g_hash_table_lookup (registered_settings_by_type, &type) == NULL);
+ nm_assert (!g_hash_table_lookup (registered_settings, name));
+ nm_assert (!g_hash_table_lookup (registered_settings_by_type, &type));
- if (priority == NM_SETTING_PRIORITY_CONNECTION)
- g_assert_cmpstr (name, ==, NM_SETTING_CONNECTION_SETTING_NAME);
+ nm_assert ( priority != NM_SETTING_PRIORITY_CONNECTION
+ || nm_streq (name, NM_SETTING_CONNECTION_SETTING_NAME));
info = g_slice_new0 (SettingInfo);
info->type = type;