summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-11-22 12:29:37 +0100
committerFrancesco Giudici <fgiudici@redhat.com>2016-11-22 15:24:47 +0100
commit417f5ad6ed5522de63527b03c92ca08301cf2849 (patch)
treeb472a680456a32f3a09514be0aa3c3362415dc0a
parent3bcca564c715efff7bb7f2ffe9ac351b256e25b8 (diff)
downloadNetworkManager-417f5ad6ed5522de63527b03c92ca08301cf2849.tar.gz
libnm-core: refactor NMSettingWired:verify() to use NM_IN_STRSET()
-rw-r--r--libnm-core/nm-setting-wired.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/libnm-core/nm-setting-wired.c b/libnm-core/nm-setting-wired.c
index 6a23ce4312..b070f2f6b8 100644
--- a/libnm-core/nm-setting-wired.c
+++ b/libnm-core/nm-setting-wired.c
@@ -618,15 +618,12 @@ static gboolean
verify (NMSetting *setting, NMConnection *connection, GError **error)
{
NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE (setting);
- const char *valid_ports[] = { "tp", "aui", "bnc", "mii", NULL };
- const char *valid_duplex[] = { "half", "full", NULL };
- const char *valid_nettype[] = { "qeth", "lcs", "ctc", NULL };
GHashTableIter iter;
const char *key, *value;
int i;
GError *local = NULL;
- if (priv->port && !g_strv_contains (valid_ports, priv->port)) {
+ if (!NM_IN_STRSET (priv->port, NULL, "tp", "aui", "bnc", "mii")) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@@ -636,7 +633,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
- if (priv->duplex && !g_strv_contains (valid_duplex, priv->duplex)) {
+ if (!NM_IN_STRSET (priv->duplex, NULL, "half", "full")) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@@ -682,7 +679,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
}
}
- if (priv->s390_nettype && !g_strv_contains (valid_nettype, priv->s390_nettype)) {
+ if (!NM_IN_STRSET (priv->s390_nettype, NULL, "qeth", "lcs", "ctc")) {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,