Commit 3f0438260f for qemu.org

commit 3f0438260f16b4b5aab9946b4757ca4a15097bb0
Author: Thomas Huth <thuth@redhat.com>
Date:   Thu Sep 10 13:21:00 2026 +0200

    util/cutils: Use qemu_isdigit() instead of isdigit()

    When building QEMU for NetBSD ("make vm-build-netbsd"), the compiler
    complains:

      In file included from /usr/include/ctype.h:100,
                     from ../src/include/qemu/osdep.h:123,
                     from ../src/util/cutils.c:25:
      ../src/util/cutils.c: In function 'do_strtosz':
      ../src/util/cutils.c:245:61: warning: array subscript has type 'char' [-Wchar-subscripts]
      245 |         if (retval == 0 && *endptr == '.' && !isdigit(endptr[1])) {

    isdigit() should not be used with plain "char" variables since these
    can be signed and isdigit() could be implemented as a macro that uses
    its parameter to index into an array. Use our wrapper qemu_isdigit()
    to fix this problem.

    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

diff --git a/util/cutils.c b/util/cutils.c
index 96c80d4d42..91ddadfd15 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -242,7 +242,7 @@ static int do_strtosz(const char *nptr, const char **end,
          */
         double fraction = 0.0;

-        if (retval == 0 && *endptr == '.' && !isdigit(endptr[1])) {
+        if (retval == 0 && *endptr == '.' && !qemu_isdigit(endptr[1])) {
             /* If we got here, we parsed at least one digit already. */
             endptr++;
         } else {