summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-04-25 15:03:31 +0200
committerThomas Haller <thaller@redhat.com>2016-04-25 15:26:26 +0200
commit79d85ca180c7510e9e6a07e7295d84f0151f0243 (patch)
tree287d7fa7d9c707c7e3e673a73a0ea24604c7ff02
parent1a714ee5e68f855b816ee947d4c49cb25c8227a4 (diff)
downloadNetworkManager-79d85ca180c7510e9e6a07e7295d84f0151f0243.tar.gz
settings: cleanup #if blocks for HOSTNAME_PERSIST_*
-rw-r--r--src/settings/nm-settings.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index f68c5f4bb7..6b06335036 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -112,6 +112,10 @@ EXPORT(nm_settings_connection_replace_and_commit)
#define PLUGIN_MODULE_PATH "plugin-module-path"
+#if (defined(HOSTNAME_PERSIST_SUSE) + defined(HOSTNAME_PERSIST_SLACKWARE) + defined(HOSTNAME_PERSIST_GENTOO)) > 1
+#error "Can only define one of HOSTNAME_PERSIST_*"
+#endif
+
#if defined(HOSTNAME_PERSIST_SUSE)
#define HOSTNAME_FILE HOSTNAME_FILE_UCASE_HOSTNAME
#elif defined(HOSTNAME_PERSIST_SLACKWARE)
@@ -522,7 +526,7 @@ read_hostname_slackware (const char *path)
while (tmp[j] != '\0') {
if (tmp[j] == '.') {
tmp[j] = '\0';
- break;
+ break;
}
j++;
}
@@ -578,23 +582,19 @@ nm_settings_get_hostname (NMSettings *self)
goto out;
}
-#if defined(HOSTNAME_PERSIST_GENTOO)
- hostname = read_hostname_gentoo (priv->hostname.file);
-#else
-
-#if defined(HOSTNAME_PERSIST_SLACKWARE)
- hostname = read_hostname_slackware (priv->hostname.file);
-#else
-
#if defined(HOSTNAME_PERSIST_SUSE)
if (priv->hostname.dhcp_monitor_id && hostname_is_dynamic ())
return NULL;
#endif
+
+#if defined(HOSTNAME_PERSIST_GENTOO)
+ hostname = read_hostname_gentoo (priv->hostname.file);
+#elif defined(HOSTNAME_PERSIST_SLACKWARE)
+ hostname = read_hostname_slackware (priv->hostname.file);
+#else
if (g_file_get_contents (priv->hostname.file, &hostname, NULL, NULL))
g_strchomp (hostname);
-
-#endif /* HOSTNAME_PERSIST_GENTOO */
-#endif /* HOSTNAME_PERSIST_SLACKWARE */
+#endif
out:
if (hostname && !hostname[0]) {