@samitouri / QOSamiQemu / commits / 261c09999b

qom: Use g_ascii_strcasecmp instead of strcasecmp

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>

Kostiantyn Kostiuk committed Mar 27, 2026 at 15:43 UTC 261c09999bc0b3e6e5df70aabcb39cc551a0cb99
1 file changed +2 -2
qom/object.c
+2 -2
@@ -1193,8 +1193,8 @@ GSList *object_class_get_list(const char *implements_type,
1193
1194 static gint object_class_cmp(gconstpointer a, gconstpointer b, gpointer d)
1195 {
1196 - return strcasecmp(object_class_get_name((ObjectClass *)a),
1197 - object_class_get_name((ObjectClass *)b));
1196 + return g_ascii_strcasecmp(object_class_get_name((ObjectClass *)a),
1197 + object_class_get_name((ObjectClass *)b));
1198 }
1199
1200 GSList *object_class_get_list_sorted(const char *implements_type,