From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Reinoud Zandijk <reinoud@netbsd.org>
Subject: [PATCH] util/cutils: Use qemu_isdigit() instead of isdigit()
Date: Thu, 10 Sep 2026 13:21:00 +0200 [thread overview]
Message-ID: <20260910112100.365573-1-thuth@redhat.com> (raw)
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>
---
util/cutils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/cutils.c b/util/cutils.c
index 96c80d4d429..91ddadfd15a 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 {
--
2.55.0
next reply other threads:[~2026-09-10 11:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 11:21 Thomas Huth [this message]
2026-09-10 12:01 ` [PATCH] util/cutils: Use qemu_isdigit() instead of isdigit() Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260910112100.365573-1-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=reinoud@netbsd.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.