summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-04-22 16:59:47 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2015-09-22 21:23:58 +0200
commitd89152c848907dd89b6b008256ade59e96d27301 (patch)
treef30fe436044bab31f0ab6e9c37aa84378a9e5523
parent77f1d5a7f0e14a9ca19cf96a3993e1e0f3ef47ce (diff)
downloadNetworkManager-d89152c848907dd89b6b008256ade59e96d27301.tar.gz
libnm-core/trivial: rename 'i' function argument to 'idx'
(cherry picked from commit 8d9776997b48e66709cf717eb8fd630869661ad9)
-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 d100d6fa3b..f87a20aa7c 100644
--- a/libnm-core/nm-setting-ip-config.c
+++ b/libnm-core/nm-setting-ip-config.c
@@ -1151,21 +1151,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];
}
/**
@@ -1207,21 +1207,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);
}
@@ -1295,21 +1295,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];
}
/**
@@ -1347,21 +1347,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);
}
@@ -1435,37 +1435,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.0.8
**/
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.0.8
**/
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;
@@ -1473,11 +1473,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;
@@ -1519,23 +1519,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.0.8
**/
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);
}
@@ -1609,21 +1609,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];
}
/**
@@ -1663,21 +1663,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);
}
@@ -1761,21 +1761,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];
}
/**
@@ -1813,21 +1813,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 9a5d47f910..ecbee61649 100644
--- a/libnm-core/tests/test-general.c
+++ b/libnm-core/tests/test-general.c
@@ -2853,7 +2853,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 ();
@@ -2863,7 +2863,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 ();
@@ -2875,7 +2875,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 ();
@@ -2888,7 +2888,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 ();
@@ -2898,7 +2898,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 ();
@@ -2929,7 +2929,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 ();
@@ -2939,7 +2939,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 ();
@@ -2952,7 +2952,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 ();
@@ -2965,7 +2965,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 ();