diff options
author | Thomas Haller <thaller@redhat.com> | 2020-02-27 16:36:50 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-03-17 08:02:54 +0100 |
commit | 607a22b900cb81fa122fdf323fe4b6c1ba5a56e2 (patch) | |
tree | 5272b88c0f9267294945f4210b8c755519b2c474 /libnm-core | |
parent | d3e5eab73423a7df099d4f9317e5159ee47e056a (diff) | |
download | NetworkManager-607a22b900cb81fa122fdf323fe4b6c1ba5a56e2.tar.gz |
libnm-core: minor cleanup checks in "nm-setting-adsl.c"'s verify()
Diffstat (limited to 'libnm-core')
-rw-r--r-- | libnm-core/nm-setting-adsl.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libnm-core/nm-setting-adsl.c b/libnm-core/nm-setting-adsl.c index e9b8666974..c952353d7b 100644 --- a/libnm-core/nm-setting-adsl.c +++ b/libnm-core/nm-setting-adsl.c @@ -158,7 +158,8 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) _("property is missing")); g_prefix_error (error, "%s.%s: ", NM_SETTING_ADSL_SETTING_NAME, NM_SETTING_ADSL_USERNAME); return FALSE; - } else if (!strlen (priv->username)) { + } + if (!priv->username[0]) { g_set_error_literal (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, @@ -167,10 +168,9 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } - if ( !priv->protocol - || ( strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA) - && strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE) - && strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_IPOATM))){ + if (!NM_IN_STRSET (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA, + NM_SETTING_ADSL_PROTOCOL_PPPOE, + NM_SETTING_ADSL_PROTOCOL_IPOATM)) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, @@ -180,9 +180,9 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } - if ( priv->encapsulation - && ( strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_VCMUX) - && strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_LLC) )) { + if (!NM_IN_STRSET (priv->encapsulation, NULL, + NM_SETTING_ADSL_ENCAPSULATION_VCMUX, + NM_SETTING_ADSL_ENCAPSULATION_LLC)) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, |