diff options
author | Dan Williams <dcbw@redhat.com> | 2014-10-13 10:26:39 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-10-27 13:46:06 -0500 |
commit | 98fe073fb9d4a25ea41d5fee5eaf81259e5b6f00 (patch) | |
tree | ebe02ff87bcaba936af1e6b54459d505ffe93b51 | |
parent | 07e086dd0da570933d2271fb8e60dde35d717b69 (diff) | |
download | NetworkManager-98fe073fb9d4a25ea41d5fee5eaf81259e5b6f00.tar.gz |
core: use _nm_utils_string_in_list() instead of private function
-rw-r--r-- | src/devices/nm-device.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 49d0402885..6c1b792c0e 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -71,6 +71,7 @@ #include "nm-dispatcher.h" #include "nm-config.h" #include "nm-dns-manager.h" +#include "nm-utils-private.h" #include "nm-device-logging.h" _LOG_DECLARE_SELF (NMDevice); @@ -1882,18 +1883,6 @@ nm_device_check_connection_compatible (NMDevice *self, NMConnection *connection) return NM_DEVICE_GET_CLASS (self)->check_connection_compatible (self, connection); } -static gboolean -string_in_list (const char *str, const char **array, gsize array_len) -{ - gsize i; - - for (i = 0; i < array_len; i++) { - if (strcmp (str, array[i]) == 0) - return TRUE; - } - return FALSE; -} - /** * nm_device_can_assume_connections: * @self: #NMDevice instance @@ -1934,11 +1923,13 @@ nm_device_can_assume_active_connection (NMDevice *self) NM_SETTING_IP6_CONFIG_METHOD_DHCP, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, + NULL }; const char *assumable_ip4_methods[] = { NM_SETTING_IP4_CONFIG_METHOD_DISABLED, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, + NULL }; if (!nm_device_can_assume_connections (self)) @@ -1957,11 +1948,11 @@ nm_device_can_assume_active_connection (NMDevice *self) return FALSE; method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG); - if (!string_in_list (method, assumable_ip6_methods, G_N_ELEMENTS (assumable_ip6_methods))) + if (!_nm_utils_string_in_list (method, assumable_ip6_methods)) return FALSE; method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG); - if (!string_in_list (method, assumable_ip4_methods, G_N_ELEMENTS (assumable_ip4_methods))) + if (!_nm_utils_string_in_list (method, assumable_ip4_methods)) return FALSE; return TRUE; |