summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-04-22 16:59:47 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2015-05-13 17:15:34 +0200
commit8d9776997b48e66709cf717eb8fd630869661ad9 (patch)
treeed83588d62c434cf476ba01bee64d39e5744ced2
parent7467e255935392885c8fb4efd46327edac7b96c7 (diff)
downloadNetworkManager-8d9776997b48e66709cf717eb8fd630869661ad9.tar.gz
libnm-core/trivial: rename 'i' function argument to 'idx'
-rw-r--r--libnm-core/nm-setting-ip-config.c112
-rw-r--r--libnm-core/nm-setting-ip-config.h22
-rw-r--r--libnm-core/tests/test-general.c18
3 files changed, 76 insertions, 76 deletions
diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c
index 0b20293ec5..281c0b9817 100644
--- a/libnm-core/nm-setting-ip-config.c
+++ b/libnm-core/nm-setting-ip-config.c
@@ -1148,21 +1148,21 @@ nm_setting_ip_config_get_num_dns (NMSettingIPConfig *setting)
/**
* nm_setting_ip_config_get_dns:
* @setting: the #NMSettingIPConfig
- * @i: index number of the DNS server to return
+ * @idx: index number of the DNS server to return
*
- * Returns: the IP address of the DNS server at index @i
+ * Returns: the IP address of the DNS server at index @idx
**/
const char *
-nm_setting_ip_config_get_dns (NMSettingIPConfig *setting, int i)
+nm_setting_ip_config_get_dns (NMSettingIPConfig *setting, int idx)
{
NMSettingIPConfigPrivate *priv;
g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL);
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < priv->dns->len, NULL);
+ g_return_val_if_fail (idx < priv->dns->len, NULL);
- return priv->dns->pdata[i];
+ return priv->dns->pdata[idx];
}
/**
@@ -1204,21 +1204,21 @@ nm_setting_ip_config_add_dns (NMSettingIPConfig *setting, const char *dns)
/**
* nm_setting_ip_config_remove_dns:
* @setting: the #NMSettingIPConfig
- * @i: index number of the DNS server to remove
+ * @idx: index number of the DNS server to remove
*
- * Removes the DNS server at index @i.
+ * Removes the DNS server at index @idx.
**/
void
-nm_setting_ip_config_remove_dns (NMSettingIPConfig *setting, int i)
+nm_setting_ip_config_remove_dns (NMSettingIPConfig *setting, int idx)
{
NMSettingIPConfigPrivate *priv;
g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
- g_return_if_fail (i < priv->dns->len);
+ g_return_if_fail (idx < priv->dns->len);
- g_ptr_array_remove_index (priv->dns, i);
+ g_ptr_array_remove_index (priv->dns, idx);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS);
}
@@ -1292,21 +1292,21 @@ nm_setting_ip_config_get_num_dns_searches (NMSettingIPConfig *setting)
/**
* nm_setting_ip_config_get_dns_search:
* @setting: the #NMSettingIPConfig
- * @i: index number of the DNS search domain to return
+ * @idx: index number of the DNS search domain to return
*
- * Returns: the DNS search domain at index @i
+ * Returns: the DNS search domain at index @idx
**/
const char *
-nm_setting_ip_config_get_dns_search (NMSettingIPConfig *setting, int i)
+nm_setting_ip_config_get_dns_search (NMSettingIPConfig *setting, int idx)
{
NMSettingIPConfigPrivate *priv;
g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL);
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < priv->dns_search->len, NULL);
+ g_return_val_if_fail (idx < priv->dns_search->len, NULL);
- return priv->dns_search->pdata[i];
+ return priv->dns_search->pdata[idx];
}
/**
@@ -1344,21 +1344,21 @@ nm_setting_ip_config_add_dns_search (NMSettingIPConfig *setting,
/**
* nm_setting_ip_config_remove_dns_search:
* @setting: the #NMSettingIPConfig
- * @i: index number of the DNS search domain
+ * @idx: index number of the DNS search domain
*
- * Removes the DNS search domain at index @i.
+ * Removes the DNS search domain at index @idx.
**/
void
-nm_setting_ip_config_remove_dns_search (NMSettingIPConfig *setting, int i)
+nm_setting_ip_config_remove_dns_search (NMSettingIPConfig *setting, int idx)
{
NMSettingIPConfigPrivate *priv;
g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
- g_return_if_fail (i < priv->dns_search->len);
+ g_return_if_fail (idx < priv->dns_search->len);
- g_ptr_array_remove_index (priv->dns_search, i);
+ g_ptr_array_remove_index (priv->dns_search, idx);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_SEARCH);
}
@@ -1432,37 +1432,37 @@ nm_setting_ip_config_get_num_dns_options (NMSettingIPConfig *setting)
/**
* nm_setting_ip_config_get_dns_option:
* @setting: the #NMSettingIPConfig
- * @i: index number of the DNS option
+ * @idx: index number of the DNS option
*
- * Returns: the DNS option at index @i
+ * Returns: the DNS option at index @idx
*
* Since: 1.2
**/
const char *
-nm_setting_ip_config_get_dns_option (NMSettingIPConfig *setting, guint i)
+nm_setting_ip_config_get_dns_option (NMSettingIPConfig *setting, guint idx)
{
NMSettingIPConfigPrivate *priv;
g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL);
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < priv->dns_options->len, NULL);
+ g_return_val_if_fail (idx < priv->dns_options->len, NULL);
- return priv->dns_options->pdata[i];
+ return priv->dns_options->pdata[idx];
}
/**
* nm_setting_ip_config_next_valid_dns_option
* @setting: the #NMSettingIPConfig
- * @i: index to start the search from
+ * @idx: index to start the search from
*
- * Returns: the index, greater or equal than @i, of the first valid
+ * Returns: the index, greater or equal than @idx, of the first valid
* DNS option, or -1 if no valid option is found
*
* Since: 1.2
**/
gint
-nm_setting_ip_config_next_valid_dns_option (NMSettingIPConfig *setting, guint i)
+nm_setting_ip_config_next_valid_dns_option (NMSettingIPConfig *setting, guint idx)
{
NMSettingIPConfigPrivate *priv;
@@ -1470,11 +1470,11 @@ nm_setting_ip_config_next_valid_dns_option (NMSettingIPConfig *setting, guint i)
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
- for (; i < priv->dns_options->len; i++) {
- if (_nm_utils_dns_option_validate (priv->dns_options->pdata[i], NULL, NULL,
+ for (; idx < priv->dns_options->len; idx++) {
+ if (_nm_utils_dns_option_validate (priv->dns_options->pdata[idx], NULL, NULL,
NM_IS_SETTING_IP6_CONFIG (setting),
dns_option_descs))
- return i;
+ return idx;
}
return -1;
@@ -1516,23 +1516,23 @@ nm_setting_ip_config_add_dns_option (NMSettingIPConfig *setting,
/**
* nm_setting_ip_config_remove_dns_option:
* @setting: the #NMSettingIPConfig
- * @i: index number of the DNS option
+ * @idx: index number of the DNS option
*
- * Removes the DNS option at index @i.
+ * Removes the DNS option at index @idx.
*
* Since: 1.2
**/
void
-nm_setting_ip_config_remove_dns_option (NMSettingIPConfig *setting, int i)
+nm_setting_ip_config_remove_dns_option (NMSettingIPConfig *setting, int idx)
{
NMSettingIPConfigPrivate *priv;
g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
- g_return_if_fail (i < priv->dns_options->len);
+ g_return_if_fail (idx < priv->dns_options->len);
- g_ptr_array_remove_index (priv->dns_options, i);
+ g_ptr_array_remove_index (priv->dns_options, idx);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_OPTIONS);
}
@@ -1606,21 +1606,21 @@ nm_setting_ip_config_get_num_addresses (NMSettingIPConfig *setting)
/**
* nm_setting_ip_config_get_address:
* @setting: the #NMSettingIPConfig
- * @i: index number of the address to return
+ * @idx: index number of the address to return
*
- * Returns: the address at index @i
+ * Returns: the address at index @idx
**/
NMIPAddress *
-nm_setting_ip_config_get_address (NMSettingIPConfig *setting, int i)
+nm_setting_ip_config_get_address (NMSettingIPConfig *setting, int idx)
{
NMSettingIPConfigPrivate *priv;
g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL);
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < priv->addresses->len, NULL);
+ g_return_val_if_fail (idx < priv->addresses->len, NULL);
- return priv->addresses->pdata[i];
+ return priv->addresses->pdata[idx];
}
/**
@@ -1660,21 +1660,21 @@ nm_setting_ip_config_add_address (NMSettingIPConfig *setting,
/**
* nm_setting_ip_config_remove_address:
* @setting: the #NMSettingIPConfig
- * @i: index number of the address to remove
+ * @idx: index number of the address to remove
*
- * Removes the address at index @i.
+ * Removes the address at index @idx.
**/
void
-nm_setting_ip_config_remove_address (NMSettingIPConfig *setting, int i)
+nm_setting_ip_config_remove_address (NMSettingIPConfig *setting, int idx)
{
NMSettingIPConfigPrivate *priv;
g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
- g_return_if_fail (i < priv->addresses->len);
+ g_return_if_fail (idx < priv->addresses->len);
- g_ptr_array_remove_index (priv->addresses, i);
+ g_ptr_array_remove_index (priv->addresses, idx);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ADDRESSES);
}
@@ -1758,21 +1758,21 @@ nm_setting_ip_config_get_num_routes (NMSettingIPConfig *setting)
/**
* nm_setting_ip_config_get_route:
* @setting: the #NMSettingIPConfig
- * @i: index number of the route to return
+ * @idx: index number of the route to return
*
- * Returns: the route at index @i
+ * Returns: the route at index @idx
**/
NMIPRoute *
-nm_setting_ip_config_get_route (NMSettingIPConfig *setting, int i)
+nm_setting_ip_config_get_route (NMSettingIPConfig *setting, int idx)
{
NMSettingIPConfigPrivate *priv;
g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), NULL);
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
- g_return_val_if_fail (i < priv->routes->len, NULL);
+ g_return_val_if_fail (idx < priv->routes->len, NULL);
- return priv->routes->pdata[i];
+ return priv->routes->pdata[idx];
}
/**
@@ -1810,21 +1810,21 @@ nm_setting_ip_config_add_route (NMSettingIPConfig *setting,
/**
* nm_setting_ip_config_remove_route:
* @setting: the #NMSettingIPConfig
- * @i: index number of the route
+ * @idx: index number of the route
*
- * Removes the route at index @i.
+ * Removes the route at index @idx.
**/
void
-nm_setting_ip_config_remove_route (NMSettingIPConfig *setting, int i)
+nm_setting_ip_config_remove_route (NMSettingIPConfig *setting, int idx)
{
NMSettingIPConfigPrivate *priv;
g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
- g_return_if_fail (i < priv->routes->len);
+ g_return_if_fail (idx < priv->routes->len);
- g_ptr_array_remove_index (priv->routes, i);
+ g_ptr_array_remove_index (priv->routes, idx);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ROUTES);
}
diff --git a/libnm-core/nm-setting-ip-config.h b/libnm-core/nm-setting-ip-config.h
index 6fa51aecb0..1e88a8bfde 100644
--- a/libnm-core/nm-setting-ip-config.h
+++ b/libnm-core/nm-setting-ip-config.h
@@ -185,46 +185,46 @@ const char *nm_setting_ip_config_get_method (NMSettingIPConfig
guint nm_setting_ip_config_get_num_dns (NMSettingIPConfig *setting);
const char *nm_setting_ip_config_get_dns (NMSettingIPConfig *setting,
- int i);
+ int idx);
gboolean nm_setting_ip_config_add_dns (NMSettingIPConfig *setting,
const char *dns);
void nm_setting_ip_config_remove_dns (NMSettingIPConfig *setting,
- int i);
+ int idx);
gboolean nm_setting_ip_config_remove_dns_by_value (NMSettingIPConfig *setting,
const char *dns);
void nm_setting_ip_config_clear_dns (NMSettingIPConfig *setting);
guint nm_setting_ip_config_get_num_dns_searches (NMSettingIPConfig *setting);
const char *nm_setting_ip_config_get_dns_search (NMSettingIPConfig *setting,
- int i);
+ int idx);
gboolean nm_setting_ip_config_add_dns_search (NMSettingIPConfig *setting,
const char *dns_search);
void nm_setting_ip_config_remove_dns_search (NMSettingIPConfig *setting,
- int i);
+ int idx);
gboolean nm_setting_ip_config_remove_dns_search_by_value (NMSettingIPConfig *setting,
const char *dns_search);
void nm_setting_ip_config_clear_dns_searches (NMSettingIPConfig *setting);
guint nm_setting_ip_config_get_num_dns_options (NMSettingIPConfig *setting);
const char *nm_setting_ip_config_get_dns_option (NMSettingIPConfig *setting,
- guint i);
+ guint idx);
gint nm_setting_ip_config_next_valid_dns_option (NMSettingIPConfig *setting,
- guint i);
+ guint idx);
gboolean nm_setting_ip_config_add_dns_option (NMSettingIPConfig *setting,
const char *dns_option);
void nm_setting_ip_config_remove_dns_option (NMSettingIPConfig *setting,
- int i);
+ int idx);
gboolean nm_setting_ip_config_remove_dns_option_by_value (NMSettingIPConfig *setting,
const char *dns_option);
void nm_setting_ip_config_clear_dns_options (NMSettingIPConfig *setting);
guint nm_setting_ip_config_get_num_addresses (NMSettingIPConfig *setting);
NMIPAddress *nm_setting_ip_config_get_address (NMSettingIPConfig *setting,
- int i);
+ int idx);
gboolean nm_setting_ip_config_add_address (NMSettingIPConfig *setting,
NMIPAddress *address);
void nm_setting_ip_config_remove_address (NMSettingIPConfig *setting,
- int i);
+ int idx);
gboolean nm_setting_ip_config_remove_address_by_value (NMSettingIPConfig *setting,
NMIPAddress *address);
void nm_setting_ip_config_clear_addresses (NMSettingIPConfig *setting);
@@ -233,11 +233,11 @@ const char *nm_setting_ip_config_get_gateway (NMSettingIPConfig
guint nm_setting_ip_config_get_num_routes (NMSettingIPConfig *setting);
NMIPRoute *nm_setting_ip_config_get_route (NMSettingIPConfig *setting,
- int i);
+ int idx);
gboolean nm_setting_ip_config_add_route (NMSettingIPConfig *setting,
NMIPRoute *route);
void nm_setting_ip_config_remove_route (NMSettingIPConfig *setting,
- int i);
+ int idx);
gboolean nm_setting_ip_config_remove_route_by_value (NMSettingIPConfig *setting,
NMIPRoute *route);
void nm_setting_ip_config_clear_routes (NMSettingIPConfig *setting);
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c
index b373f65322..77009c2dcb 100644
--- a/libnm-core/tests/test-general.c
+++ b/libnm-core/tests/test-general.c
@@ -2844,7 +2844,7 @@ test_setting_ip4_changed_signal (void)
ASSERT_CHANGED (nm_setting_ip_config_add_dns (s_ip4, "11.22.0.0"));
ASSERT_CHANGED (nm_setting_ip_config_remove_dns (s_ip4, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns->len*");
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*idx < priv->dns->len*");
ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns (s_ip4, 1));
g_test_assert_expected_messages ();
@@ -2854,7 +2854,7 @@ test_setting_ip4_changed_signal (void)
ASSERT_CHANGED (nm_setting_ip_config_add_dns_search (s_ip4, "foobar.com"));
ASSERT_CHANGED (nm_setting_ip_config_remove_dns_search (s_ip4, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns_search->len*");
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*idx < priv->dns_search->len*");
ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns_search (s_ip4, 1));
g_test_assert_expected_messages ();
@@ -2866,7 +2866,7 @@ test_setting_ip4_changed_signal (void)
ASSERT_CHANGED (nm_setting_ip_config_add_address (s_ip4, addr));
ASSERT_CHANGED (nm_setting_ip_config_remove_address (s_ip4, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->addresses->len*");
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*idx < priv->addresses->len*");
ASSERT_UNCHANGED (nm_setting_ip_config_remove_address (s_ip4, 1));
g_test_assert_expected_messages ();
@@ -2879,7 +2879,7 @@ test_setting_ip4_changed_signal (void)
ASSERT_CHANGED (nm_setting_ip_config_add_route (s_ip4, route));
ASSERT_CHANGED (nm_setting_ip_config_remove_route (s_ip4, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->routes->len*");
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*idx < priv->routes->len*");
ASSERT_UNCHANGED (nm_setting_ip_config_remove_route (s_ip4, 1));
g_test_assert_expected_messages ();
@@ -2889,7 +2889,7 @@ test_setting_ip4_changed_signal (void)
ASSERT_CHANGED (nm_setting_ip_config_add_dns_option (s_ip4, "debug"));
ASSERT_CHANGED (nm_setting_ip_config_remove_dns_option (s_ip4, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns_options->len*");
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*idx < priv->dns_options->len*");
ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns_option (s_ip4, 1));
g_test_assert_expected_messages ();
@@ -2920,7 +2920,7 @@ test_setting_ip6_changed_signal (void)
ASSERT_CHANGED (nm_setting_ip_config_add_dns (s_ip6, "1:2:3::4:5:6"));
ASSERT_CHANGED (nm_setting_ip_config_remove_dns (s_ip6, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns->len*");
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*idx < priv->dns->len*");
ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns (s_ip6, 1));
g_test_assert_expected_messages ();
@@ -2930,7 +2930,7 @@ test_setting_ip6_changed_signal (void)
ASSERT_CHANGED (nm_setting_ip_config_add_dns_search (s_ip6, "foobar.com"));
ASSERT_CHANGED (nm_setting_ip_config_remove_dns_search (s_ip6, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->dns_search->len*");
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*idx < priv->dns_search->len*");
ASSERT_UNCHANGED (nm_setting_ip_config_remove_dns_search (s_ip6, 1));
g_test_assert_expected_messages ();
@@ -2943,7 +2943,7 @@ test_setting_ip6_changed_signal (void)
ASSERT_CHANGED (nm_setting_ip_config_add_address (s_ip6, addr));
ASSERT_CHANGED (nm_setting_ip_config_remove_address (s_ip6, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->addresses->len*");
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*idx < priv->addresses->len*");
ASSERT_UNCHANGED (nm_setting_ip_config_remove_address (s_ip6, 1));
g_test_assert_expected_messages ();
@@ -2956,7 +2956,7 @@ test_setting_ip6_changed_signal (void)
ASSERT_CHANGED (nm_setting_ip_config_add_route (s_ip6, route));
ASSERT_CHANGED (nm_setting_ip_config_remove_route (s_ip6, 0));
- g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*i < priv->routes->len*");
+ g_test_expect_message ("libnm", G_LOG_LEVEL_CRITICAL, "*idx < priv->routes->len*");
ASSERT_UNCHANGED (nm_setting_ip_config_remove_route (s_ip6, 1));
g_test_assert_expected_messages ();