Commit 26d10b93c3 for qemu.org
commit 26d10b93c3c7e72dfcd84f3d53eccf8abf6fe4e6
Author: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Date: Fri Mar 27 15:43:53 2026 +0200
target/riscv: Use glib2 instead of strcasecmp/strncasecmp
This is a change in semantics. g_ascii_strcasecmp() doesn't honour
locale but strcasecmp() does. But this is OK for at least one reason:
(1) QEMU always runs with the C locale so there's not an actual
behaviour change here
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Link: https://lore.kernel.org/r/20260327134401.270186-8-kkostiuk@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c
index a9d3111444..bca04a7580 100644
--- a/target/riscv/monitor.c
+++ b/target/riscv/monitor.c
@@ -303,7 +303,7 @@ static bool reg_is_vreg(const char *name)
}
for (int i = 0; i < 32; i++) {
- if (strcasecmp(name, riscv_rvv_regnames[i]) == 0) {
+ if (g_ascii_strcasecmp(name, riscv_rvv_regnames[i]) == 0) {
return true;
}
}
@@ -358,7 +358,7 @@ int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval)
continue;
}
- if (strcasecmp(csr_ops[csrno].name, name) != 0) {
+ if (g_ascii_strcasecmp(csr_ops[csrno].name, name) != 0) {
continue;
}