mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 11:10:09 +01:00
core: add nm_config_keyfile_get_int64() util
This commit is contained in:
parent
989b5fabaa
commit
3f38b76515
2 changed files with 34 additions and 0 deletions
|
|
@ -182,6 +182,33 @@ nm_config_keyfile_get_boolean (const GKeyFile *keyfile,
|
|||
return nm_config_parse_boolean (str, default_value);
|
||||
}
|
||||
|
||||
gint64
|
||||
nm_config_keyfile_get_int64 (const GKeyFile *keyfile,
|
||||
const char *section,
|
||||
const char *key,
|
||||
guint base,
|
||||
gint64 min,
|
||||
gint64 max,
|
||||
gint64 fallback)
|
||||
{
|
||||
gint64 v;
|
||||
int errsv;
|
||||
char *str;
|
||||
|
||||
g_return_val_if_fail (keyfile, fallback);
|
||||
g_return_val_if_fail (section, fallback);
|
||||
g_return_val_if_fail (key, fallback);
|
||||
|
||||
str = g_key_file_get_value ((GKeyFile *) keyfile, section, key, NULL);
|
||||
v = _nm_utils_ascii_str_to_int64 (str, base, min, max, fallback);
|
||||
if (str) {
|
||||
errsv = errno;
|
||||
g_free (str);
|
||||
errno = errsv;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
char *
|
||||
nm_config_keyfile_get_value (const GKeyFile *keyfile,
|
||||
const char *section,
|
||||
|
|
|
|||
|
|
@ -166,6 +166,13 @@ gint nm_config_keyfile_get_boolean (const GKeyFile *keyfile,
|
|||
const char *section,
|
||||
const char *key,
|
||||
gint default_value);
|
||||
gint64 nm_config_keyfile_get_int64 (const GKeyFile *keyfile,
|
||||
const char *section,
|
||||
const char *key,
|
||||
guint base,
|
||||
gint64 min,
|
||||
gint64 max,
|
||||
gint64 fallback);
|
||||
char *nm_config_keyfile_get_value (const GKeyFile *keyfile,
|
||||
const char *section,
|
||||
const char *key,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue