Commit a61af4a3bf for qemu.org
commit a61af4a3bf77916c9559bb46c068458b607a9601
Author: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Date: Fri Mar 27 15:43:52 2026 +0200
target/sparc: 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
(2) we want the comparison on boolean property value to be a plain
ASCII one, not to do weird things with "I" in Turkish locales,
so g_ascii_strcasecmp() is better as it's explicit about that
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Link: https://lore.kernel.org/r/20260327134401.270186-7-kkostiuk@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index 1493336e7a..7704610428 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -174,10 +174,10 @@ static void sparc_cpu_parse_features(const char *typename, char *features,
* TODO: remove minus-override-plus semantics after
* warning for a few releases
*/
- if (!strcasecmp(val, "on") ||
- !strcasecmp(val, "off") ||
- !strcasecmp(val, "true") ||
- !strcasecmp(val, "false")) {
+ if (!g_ascii_strcasecmp(val, "on") ||
+ !g_ascii_strcasecmp(val, "off") ||
+ !g_ascii_strcasecmp(val, "true") ||
+ !g_ascii_strcasecmp(val, "false")) {
error_setg(errp, "Boolean properties in format %s=%s"
" are not supported", name, val);
return;