mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 02:40:17 +01:00
device: refactor NMDevice's can_reapply_change() to return early
Don't have if-else-if structure, if we can always return from an "if" block, once we matched the setting-name.
This commit is contained in:
parent
cc35dc3bdf
commit
d75c31afd0
1 changed files with 27 additions and 21 deletions
|
|
@ -12387,28 +12387,34 @@ can_reapply_change(NMDevice * self,
|
|||
NM_SETTING_CONNECTION_LLDP,
|
||||
NM_SETTING_CONNECTION_MDNS,
|
||||
NM_SETTING_CONNECTION_LLMNR);
|
||||
} else if (NM_IN_STRSET(setting_name,
|
||||
NM_SETTING_USER_SETTING_NAME,
|
||||
NM_SETTING_PROXY_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME)) {
|
||||
return TRUE;
|
||||
} else if (nm_streq(setting_name, NM_SETTING_WIRED_SETTING_NAME)
|
||||
&& NM_IN_SET(NM_DEVICE_GET_CLASS(self)->get_configured_mtu,
|
||||
nm_device_get_configured_mtu_wired_parent,
|
||||
nm_device_get_configured_mtu_for_wired)) {
|
||||
return nm_device_hash_check_invalid_keys(diffs,
|
||||
NM_SETTING_WIRED_SETTING_NAME,
|
||||
error,
|
||||
NM_SETTING_WIRED_MTU);
|
||||
} else {
|
||||
g_set_error(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
|
||||
"Can't reapply any changes to '%s' setting",
|
||||
setting_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (NM_IN_STRSET(setting_name,
|
||||
NM_SETTING_USER_SETTING_NAME,
|
||||
NM_SETTING_PROXY_SETTING_NAME,
|
||||
NM_SETTING_IP4_CONFIG_SETTING_NAME,
|
||||
NM_SETTING_IP6_CONFIG_SETTING_NAME))
|
||||
return TRUE;
|
||||
|
||||
if (nm_streq(setting_name, NM_SETTING_WIRED_SETTING_NAME)) {
|
||||
if (NM_IN_SET(NM_DEVICE_GET_CLASS(self)->get_configured_mtu,
|
||||
nm_device_get_configured_mtu_wired_parent,
|
||||
nm_device_get_configured_mtu_for_wired)) {
|
||||
return nm_device_hash_check_invalid_keys(diffs,
|
||||
NM_SETTING_WIRED_SETTING_NAME,
|
||||
error,
|
||||
NM_SETTING_WIRED_MTU);
|
||||
}
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
out_fail:
|
||||
g_set_error(error,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
|
||||
"Can't reapply any changes to '%s' setting",
|
||||
setting_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue