mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 23:50:16 +01:00
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.
This commit is contained in:
parent
837a8c1ca5
commit
1d6b717401
1 changed files with 7 additions and 12 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue