]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qom: Use g_ascii_strcasecmp instead of strcasecmp
authorKostiantyn Kostiuk <kkostiuk@redhat.com>
Fri, 27 Mar 2026 13:43:48 +0000 (15:43 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 23 Apr 2026 10:27:26 +0000 (12:27 +0200)
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 class names 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

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Link: https://lore.kernel.org/r/20260327134401.270186-3-kkostiuk@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qom/object.c

index ff8ede8a328e2bcb1c432b7a49ffda84153e9f15..e5c0c2f53ede9cbcd9cb551edce4ac151d86ab13 100644 (file)
@@ -1193,8 +1193,8 @@ GSList *object_class_get_list(const char *implements_type,
 
 static gint object_class_cmp(gconstpointer a, gconstpointer b, gpointer d)
 {
-    return strcasecmp(object_class_get_name((ObjectClass *)a),
-                      object_class_get_name((ObjectClass *)b));
+    return g_ascii_strcasecmp(object_class_get_name((ObjectClass *)a),
+                              object_class_get_name((ObjectClass *)b));
 }
 
 GSList *object_class_get_list_sorted(const char *implements_type,