@samitouri / QOSamiQemu / commits / a61af4a3bf

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>

Kostiantyn Kostiuk committed Mar 27, 2026 at 15:43 UTC a61af4a3bf77916c9559bb46c068458b607a9601
1 file changed +4 -4
target/sparc/cpu.c
+4 -4
@@ -174,10 +174,10 @@ static void sparc_cpu_parse_features(const char *typename, char *features,
174 * TODO: remove minus-override-plus semantics after
175 * warning for a few releases
176 */
177 - if (!strcasecmp(val, "on") ||
178 - !strcasecmp(val, "off") ||
179 - !strcasecmp(val, "true") ||
180 - !strcasecmp(val, "false")) {
177 + if (!g_ascii_strcasecmp(val, "on") ||
178 + !g_ascii_strcasecmp(val, "off") ||
179 + !g_ascii_strcasecmp(val, "true") ||
180 + !g_ascii_strcasecmp(val, "false")) {
181 error_setg(errp, "Boolean properties in format %s=%s"
182 " are not supported", name, val);
183 return;