mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 11:58:12 +02:00
shared: use nm_str_skip_leading_spaces() in _nm_utils_ascii_str_to_int64()
(cherry picked from commit 9d2623cceb)
This commit is contained in:
parent
4be7cf71e0
commit
84bd35e4fa
1 changed files with 3 additions and 6 deletions
|
|
@ -734,10 +734,7 @@ _nm_utils_ascii_str_to_int64 (const char *str, guint base, gint64 min, gint64 ma
|
||||||
gint64 v;
|
gint64 v;
|
||||||
const char *s = NULL;
|
const char *s = NULL;
|
||||||
|
|
||||||
if (str) {
|
str = nm_str_skip_leading_spaces (str);
|
||||||
while (g_ascii_isspace (str[0]))
|
|
||||||
str++;
|
|
||||||
}
|
|
||||||
if (!str || !str[0]) {
|
if (!str || !str[0]) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return fallback;
|
return fallback;
|
||||||
|
|
@ -748,9 +745,9 @@ _nm_utils_ascii_str_to_int64 (const char *str, guint base, gint64 min, gint64 ma
|
||||||
|
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
return fallback;
|
return fallback;
|
||||||
|
|
||||||
if (s[0] != '\0') {
|
if (s[0] != '\0') {
|
||||||
while (g_ascii_isspace (s[0]))
|
s = nm_str_skip_leading_spaces (s);
|
||||||
s++;
|
|
||||||
if (s[0] != '\0') {
|
if (s[0] != '\0') {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return fallback;
|
return fallback;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue