trivial: rename nm_utils_ascii_str_to_int64() to _nm_utils_ascii_str_to_int64()

(cherry picked from commit 093f6d477b)
This commit is contained in:
Thomas Haller 2015-02-22 11:55:31 +01:00
parent 0916861c5c
commit a4d11bae29
12 changed files with 24 additions and 24 deletions

View file

@ -1803,7 +1803,7 @@ nm_utils_cmp_connection_by_autoconnect_priority (NMConnection **a, NMConnection
return 0;
}
/* nm_utils_ascii_str_to_int64:
/* _nm_utils_ascii_str_to_int64:
*
* A wrapper for g_ascii_strtoll, that checks whether the whole string
* can be successfully converted to a number and is within a given
@ -1818,7 +1818,7 @@ nm_utils_cmp_connection_by_autoconnect_priority (NMConnection **a, NMConnection
* white space.
**/
gint64
nm_utils_ascii_str_to_int64 (const char *str, guint base, gint64 min, gint64 max, gint64 fallback)
_nm_utils_ascii_str_to_int64 (const char *str, guint base, gint64 min, gint64 max, gint64 fallback)
{
gint64 v;
size_t len;

View file

@ -163,7 +163,7 @@ int nm_utils_cmp_connection_by_autoconnect_priority (NMConnection **a, NMConnect
void nm_utils_log_connection_diff (NMConnection *connection, NMConnection *diff_base, guint32 level, guint64 domain, const char *name, const char *prefix);
gint64 nm_utils_ascii_str_to_int64 (const char *str, guint base, gint64 min, gint64 max, gint64 fallback);
gint64 _nm_utils_ascii_str_to_int64 (const char *str, guint base, gint64 min, gint64 max, gint64 fallback);
#define NM_UTILS_UUID_NS "b425e9fb-7598-44b4-9e3b-5a2e3aaa4905"

View file

@ -132,7 +132,7 @@ handle_event (DBusGProxy *proxy,
}
pid_str = get_option (options, "pid");
pid = nm_utils_ascii_str_to_int64 (pid_str, 10, 0, G_MAXINT32, -1);
pid = _nm_utils_ascii_str_to_int64 (pid_str, 10, 0, G_MAXINT32, -1);
if (pid == -1) {
nm_log_warn (LOGD_DHCP, "DHCP event: couldn't convert PID '%s' to an integer", pid_str ? pid_str : "(null)");
goto out;

View file

@ -351,7 +351,7 @@ constructed (GObject *object)
* the interval to zero. */
interval = g_key_file_get_value (priv->keyfile, "connectivity", "interval", NULL);
priv->connectivity.interval = interval
? nm_utils_ascii_str_to_int64 (interval, 10, 0, G_MAXUINT, 0)
? _nm_utils_ascii_str_to_int64 (interval, 10, 0, G_MAXUINT, 0)
: NM_CONFIG_DEFAULT_CONNECTIVITY_INTERVAL;
g_free (interval);

View file

@ -2792,7 +2792,7 @@ link_get_dev_id (NMPlatform *platform, int ifindex)
return 0;
/* Value is reported as hex */
int_val = nm_utils_ascii_str_to_int64 (id, 16, 0, G_MAXUINT16, 0);
int_val = _nm_utils_ascii_str_to_int64 (id, 16, 0, G_MAXUINT16, 0);
return errno ? 0 : (int) int_val;
}
@ -3054,7 +3054,7 @@ tun_get_properties (NMPlatform *platform, int ifindex, NMPlatformTunProperties *
val = nm_platform_sysctl_get (path);
g_free (path);
if (val) {
props->owner = nm_utils_ascii_str_to_int64 (val, 10, -1, G_MAXINT64, -1);
props->owner = _nm_utils_ascii_str_to_int64 (val, 10, -1, G_MAXINT64, -1);
if (errno)
success = FALSE;
g_free (val);
@ -3065,7 +3065,7 @@ tun_get_properties (NMPlatform *platform, int ifindex, NMPlatformTunProperties *
val = nm_platform_sysctl_get (path);
g_free (path);
if (val) {
props->group = nm_utils_ascii_str_to_int64 (val, 10, -1, G_MAXINT64, -1);
props->group = _nm_utils_ascii_str_to_int64 (val, 10, -1, G_MAXINT64, -1);
if (errno)
success = FALSE;
g_free (val);
@ -3078,7 +3078,7 @@ tun_get_properties (NMPlatform *platform, int ifindex, NMPlatformTunProperties *
if (val) {
gint64 flags;
flags = nm_utils_ascii_str_to_int64 (val, 16, 0, G_MAXINT64, 0);
flags = _nm_utils_ascii_str_to_int64 (val, 16, 0, G_MAXINT64, 0);
if (!errno) {
#ifndef IFF_MULTI_QUEUE
const int IFF_MULTI_QUEUE = 0x0100;

View file

@ -354,7 +354,7 @@ nm_platform_sysctl_get_int_checked (const char *path, guint base, gint64 min, gi
return fallback;
}
ret = nm_utils_ascii_str_to_int64 (value, base, min, max, fallback);
ret = _nm_utils_ascii_str_to_int64 (value, base, min, max, fallback);
g_free (value);
return ret;
}

View file

@ -439,7 +439,7 @@ is_ibft_vlan_device (const GPtrArray *block)
/* VLAN 0 is normally a valid VLAN ID, but in the iBFT case it
* means "no VLAN".
*/
if (nm_utils_ascii_str_to_int64 (s_vlan_id, 10, 1, 4095, -1) != -1)
if (_nm_utils_ascii_str_to_int64 (s_vlan_id, 10, 1, 4095, -1) != -1)
return TRUE;
}
return FALSE;
@ -466,7 +466,7 @@ vlan_setting_add_from_block (const GPtrArray *block,
g_assert (vlan_id_str);
/* VLAN 0 is normally a valid VLAN ID, but in the iBFT case it means "no VLAN" */
vlan_id = nm_utils_ascii_str_to_int64 (vlan_id_str, 10, 1, 4095, -1);
vlan_id = _nm_utils_ascii_str_to_int64 (vlan_id_str, 10, 1, 4095, -1);
if (vlan_id == -1) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"Invalid VLAN_ID '%s'", vlan_id_str);

View file

@ -507,7 +507,7 @@ read_one_ip4_route (shvarFile *ifcfg,
/* Metric */
value = svGetValue (ifcfg, metric_tag, FALSE);
if (value) {
metric = nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT32, -1);
metric = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT32, -1);
if (metric < 0) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"Invalid IP4 route metric '%s'", value);
@ -3351,7 +3351,7 @@ make_wireless_setting (shvarFile *ifcfg,
value = svGetValue (ifcfg, "CHANNEL", FALSE);
if (value) {
errno = 0;
chan = nm_utils_ascii_str_to_int64 (value, 10, 1, 196, 0);
chan = _nm_utils_ascii_str_to_int64 (value, 10, 1, 196, 0);
if (errno || (chan == 0)) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"Invalid wireless channel '%s'", value);
@ -4885,7 +4885,7 @@ devtimeout_from_file (const char *filename)
devtimeout_str = svGetValue (ifcfg, "DEVTIMEOUT", FALSE);
if (devtimeout_str) {
devtimeout = nm_utils_ascii_str_to_int64 (devtimeout_str, 10, 0, G_MAXUINT, 0);
devtimeout = _nm_utils_ascii_str_to_int64 (devtimeout_str, 10, 0, G_MAXUINT, 0);
g_free (devtimeout_str);
} else
devtimeout = 0;

View file

@ -321,7 +321,7 @@ svTrueValue (shvarFile *s, const char *key, gboolean def)
* @max: the maximum for range-check
* @fallback: the fallback value in any error case
*
* Reads a value @key and converts it to an integer using nm_utils_ascii_str_to_int64().
* Reads a value @key and converts it to an integer using _nm_utils_ascii_str_to_int64().
* In case of error, @errno will be set and @fallback returned. */
gint64
svGetValueInt64 (shvarFile *s, const char *key, guint base, gint64 min, gint64 max, gint64 fallback)
@ -336,7 +336,7 @@ svGetValueInt64 (shvarFile *s, const char *key, guint base, gint64 min, gint64 m
return fallback;
}
result = nm_utils_ascii_str_to_int64 (tmp, base, min, max, fallback);
result = _nm_utils_ascii_str_to_int64 (tmp, base, min, max, fallback);
errsv = errno;
if (errsv != 0)
PARSE_WARNING ("Error reading '%s' value '%s' as integer (%d)", key, tmp, errsv);

View file

@ -706,13 +706,13 @@ make_ip4_setting (NMConnection *connection,
GError *local = NULL;
if ((metric_str = ifnet_get_data (conn_name, "metric")) != NULL) {
metric = nm_utils_ascii_str_to_int64 (metric_str, 10, 0, G_MAXUINT32, -1);
metric = _nm_utils_ascii_str_to_int64 (metric_str, 10, 0, G_MAXUINT32, -1);
} else {
metric_str = ifnet_get_global_data ("metric");
if (metric_str) {
stripped = g_strdup (metric_str);
strip_string (stripped, '"');
metric = nm_utils_ascii_str_to_int64 (metric_str, 10, 0, G_MAXUINT32, -1);
metric = _nm_utils_ascii_str_to_int64 (metric_str, 10, 0, G_MAXUINT32, -1);
g_free (stripped);
} else
metric = -1;
@ -846,13 +846,13 @@ make_ip6_setting (NMConnection *connection,
/* metric is not per routes configuration right now
* global metric is also supported (metric="x") */
if ((metric_str = ifnet_get_data (conn_name, "metric")) != NULL)
metric = nm_utils_ascii_str_to_int64 (metric_str, 10, 0, G_MAXUINT32, -1);
metric = _nm_utils_ascii_str_to_int64 (metric_str, 10, 0, G_MAXUINT32, -1);
else {
metric_str = ifnet_get_global_data ("metric");
if (metric_str) {
stripped = g_strdup (metric_str);
strip_string (stripped, '"');
metric = nm_utils_ascii_str_to_int64 (metric_str, 10, 0, G_MAXUINT32, -1);
metric = _nm_utils_ascii_str_to_int64 (metric_str, 10, 0, G_MAXUINT32, -1);
g_free (stripped);
} else
metric = 1;

View file

@ -1135,7 +1135,7 @@ read_one_setting_value (NMSetting *setting,
gint64 int_val;
tmp_str = nm_keyfile_plugin_kf_get_value (info->keyfile, setting_name, key, NULL);
int_val = nm_utils_ascii_str_to_int64 (tmp_str, 10, G_MININT64, G_MAXINT64, 0);
int_val = _nm_utils_ascii_str_to_int64 (tmp_str, 10, G_MININT64, G_MAXINT64, 0);
errsv = errno;
if (errsv)
nm_log_warn (LOGD_SETTINGS, "Invalid int64 value (%s)", tmp_str);

View file

@ -38,7 +38,7 @@ test_nm_utils_ascii_str_to_int64_check (const char *str, guint base, gint64 min,
gint64 v;
errno = 1;
v = nm_utils_ascii_str_to_int64 (str, base, min, max, fallback);
v = _nm_utils_ascii_str_to_int64 (str, base, min, max, fallback);
g_assert_cmpint (errno, ==, exp_errno);
g_assert_cmpint (v, ==, exp_val);
}
@ -893,7 +893,7 @@ main (int argc, char **argv)
{
nmtst_init_with_logging (&argc, &argv, NULL, "ALL");
g_test_add_func ("/general/nm_utils_ascii_str_to_int64", test_nm_utils_ascii_str_to_int64);
g_test_add_func ("/general/_nm_utils_ascii_str_to_int64", test_nm_utils_ascii_str_to_int64);
g_test_add_func ("/general/nm_utils_ip6_address_clear_host_address", test_nm_utils_ip6_address_clear_host_address);
g_test_add_func ("/general/nm_utils_log_connection_diff", test_nm_utils_log_connection_diff);