@samitouri / QOSamiQemu / commits / 26d10b93c3

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>

Kostiantyn Kostiuk committed Mar 27, 2026 at 15:43 UTC 26d10b93c3c7e72dfcd84f3d53eccf8abf6fe4e6
1 file changed +2 -2
target/riscv/monitor.c
+2 -2
@@ -303,7 +303,7 @@ static bool reg_is_vreg(const char *name)
303 }
304
305 for (int i = 0; i < 32; i++) {
306 - if (strcasecmp(name, riscv_rvv_regnames[i]) == 0) {
306 + if (g_ascii_strcasecmp(name, riscv_rvv_regnames[i]) == 0) {
307 return true;
308 }
309 }
@@ -358,7 +358,7 @@ int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval)
358 continue;
359 }
360
361 - if (strcasecmp(csr_ops[csrno].name, name) != 0) {
361 + if (g_ascii_strcasecmp(csr_ops[csrno].name, name) != 0) {
362 continue;
363 }
364