From bc79d61b2d3c29f41c90e023a7b65f11adfd835a Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 12 Jun 2024 09:04:25 +0300 Subject: [PATCH] (str_verscmp): glibification. Use g_ascii_isdigit() instead of isdigit(). Signed-off-by: Andrew Borodin --- lib/strutil/strverscmp.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/strutil/strverscmp.c b/lib/strutil/strverscmp.c index 26ab5e9c5..048d0fd07 100644 --- a/lib/strutil/strverscmp.c +++ b/lib/strutil/strverscmp.c @@ -39,7 +39,6 @@ #include -#include #ifdef HAVE_STRVERSCMP #include #endif /* HAVE_STRVERSCMP */ @@ -122,7 +121,7 @@ str_verscmp (const char *s1, const char *s2) c1 = *p1++; c2 = *p2++; /* Hint: '0' is a digit too. */ - state = S_N + ((c1 == '0') + (isdigit (c1) != 0)); + state = S_N + ((c1 == '0') + (g_ascii_isdigit (c1) ? 1 : 0)); while ((diff = c1 - c2) == 0) { @@ -132,10 +131,10 @@ str_verscmp (const char *s1, const char *s2) state = next_state[state]; c1 = *p1++; c2 = *p2++; - state += (c1 == '0') + (isdigit (c1) != 0); + state += (c1 == '0') + (g_ascii_isdigit (c1) ? 1 : 0); } - state = result_type[state * 3 + (((c2 == '0') + (isdigit (c2) != 0)))]; + state = result_type[state * 3 + (((c2 == '0') + (g_ascii_isdigit (c2) ? 1 : 0)))]; switch (state) { @@ -143,11 +142,11 @@ str_verscmp (const char *s1, const char *s2) return diff; case LEN: - while (isdigit (*p1++)) - if (!isdigit (*p2++)) + while (g_ascii_isdigit (*p1++)) + if (!g_ascii_isdigit (*p2++)) return 1; - return isdigit (*p2) ? -1 : diff; + return g_ascii_isdigit (*p2) ? -1 : diff; default: return state;