diff options
| author | Michael Biebl <biebl@debian.org> | 2016-05-11 17:08:25 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2016-05-11 17:08:25 +0200 |
| commit | 73e152af6e3fb4f5848bfb8394484026ff119003 (patch) | |
| tree | d5a8b37778d3a95c51511451b38b6a329b94cb41 /shared | |
| parent | 78c3b8801ecf4975e5da1af3b10ae20dd2d876de (diff) | |
Imported Upstream version 1.2.2 upstream/1.2.2
Diffstat (limited to 'shared')
| -rw-r--r-- | shared/nm-shared-utils.c | 47 | ||||
| -rw-r--r-- | shared/nm-version-macros.h | 8 | ||||
| -rw-r--r-- | shared/nm-version-macros.h.in | 6 |
3 files changed, 21 insertions, 40 deletions
diff --git a/shared/nm-shared-utils.c b/shared/nm-shared-utils.c index 932b7432..38f6529d 100644 --- a/shared/nm-shared-utils.c +++ b/shared/nm-shared-utils.c @@ -45,8 +45,7 @@ gint64 _nm_utils_ascii_str_to_int64 (const char *str, guint base, gint64 min, gint64 max, gint64 fallback) { gint64 v; - size_t len; - char buf[64], *s, *str_free = NULL; + char *s = NULL; if (str) { while (g_ascii_isspace (str[0])) @@ -57,46 +56,24 @@ _nm_utils_ascii_str_to_int64 (const char *str, guint base, gint64 min, gint64 ma return fallback; } - len = strlen (str); - if (g_ascii_isspace (str[--len])) { - /* backward search the first non-ws character. - * We already know that str[0] is non-ws. */ - while (g_ascii_isspace (str[--len])) - ; - - /* str[len] is now the last non-ws character... */ - len++; - - if (len >= sizeof (buf)) - s = str_free = g_malloc (len + 1); - else - s = buf; - - memcpy (s, str, len); - s[len] = 0; - - nm_assert (len > 0 && len < strlen (str) && len == strlen (s)); - nm_assert (!g_ascii_isspace (str[len-1]) && g_ascii_isspace (str[len])); - nm_assert (strncmp (str, s, len) == 0); - - str = s; - } - errno = 0; v = g_ascii_strtoll (str, &s, base); if (errno != 0) - v = fallback; - else if (s[0] != 0) { - errno = EINVAL; - v = fallback; - } else if (v > max || v < min) { + return fallback; + if (s[0] != '\0') { + while (g_ascii_isspace (s[0])) + s++; + if (s[0] != '\0') { + errno = EINVAL; + return fallback; + } + } + if (v > max || v < min) { errno = ERANGE; - v = fallback; + return fallback; } - if (G_UNLIKELY (str_free)) - g_free (str_free); return v; } diff --git a/shared/nm-version-macros.h b/shared/nm-version-macros.h index be94ce76..50c9748d 100644 --- a/shared/nm-version-macros.h +++ b/shared/nm-version-macros.h @@ -45,7 +45,7 @@ * Evaluates to the micro version number of NetworkManager which this source * compiled against. */ -#define NM_MICRO_VERSION (0) +#define NM_MICRO_VERSION (2) /** * NM_CHECK_VERSION: @@ -68,9 +68,11 @@ #define NM_VERSION_0_9_10 (NM_ENCODE_VERSION (0, 9, 10)) #define NM_VERSION_1_0 (NM_ENCODE_VERSION (1, 0, 0)) #define NM_VERSION_1_2 (NM_ENCODE_VERSION (1, 2, 0)) +#define NM_VERSION_1_2_2 (NM_ENCODE_VERSION (1, 2, 2)) +#define NM_VERSION_1_2_4 (NM_ENCODE_VERSION (1, 2, 4)) #define NM_VERSION_1_4 (NM_ENCODE_VERSION (1, 4, 0)) -#define NM_VERSION_CUR_STABLE NM_VERSION_1_0 -#define NM_VERSION_NEXT_STABLE NM_VERSION_1_2 +#define NM_VERSION_CUR_STABLE NM_VERSION_1_2_2 +#define NM_VERSION_NEXT_STABLE NM_VERSION_1_2_4 #endif /* __NM_VERSION_MACROS_H__ */ diff --git a/shared/nm-version-macros.h.in b/shared/nm-version-macros.h.in index 92bc65bc..3e0ef361 100644 --- a/shared/nm-version-macros.h.in +++ b/shared/nm-version-macros.h.in @@ -68,9 +68,11 @@ #define NM_VERSION_0_9_10 (NM_ENCODE_VERSION (0, 9, 10)) #define NM_VERSION_1_0 (NM_ENCODE_VERSION (1, 0, 0)) #define NM_VERSION_1_2 (NM_ENCODE_VERSION (1, 2, 0)) +#define NM_VERSION_1_2_2 (NM_ENCODE_VERSION (1, 2, 2)) +#define NM_VERSION_1_2_4 (NM_ENCODE_VERSION (1, 2, 4)) #define NM_VERSION_1_4 (NM_ENCODE_VERSION (1, 4, 0)) -#define NM_VERSION_CUR_STABLE NM_VERSION_1_0 -#define NM_VERSION_NEXT_STABLE NM_VERSION_1_2 +#define NM_VERSION_CUR_STABLE NM_VERSION_1_2_2 +#define NM_VERSION_NEXT_STABLE NM_VERSION_1_2_4 #endif /* __NM_VERSION_MACROS_H__ */ |