mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
qom: introduce object_class_get_list_sorted
Unify half a dozen copies of very similar code (the only difference being whether comparisons were case-sensitive) and use it also in Tricore, which did not do any sorting of CPU model names. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
819fd4699c
commit
47c66009ab
8 changed files with 30 additions and 65 deletions
|
@ -122,12 +122,6 @@ static void qdev_print_devinfo(DeviceClass *dc)
|
|||
error_printf("\n");
|
||||
}
|
||||
|
||||
static gint devinfo_cmp(gconstpointer a, gconstpointer b)
|
||||
{
|
||||
return strcasecmp(object_class_get_name((ObjectClass *)a),
|
||||
object_class_get_name((ObjectClass *)b));
|
||||
}
|
||||
|
||||
static void qdev_print_devinfos(bool show_no_user)
|
||||
{
|
||||
static const char *cat_name[DEVICE_CATEGORY_MAX + 1] = {
|
||||
|
@ -146,8 +140,7 @@ static void qdev_print_devinfos(bool show_no_user)
|
|||
int i;
|
||||
bool cat_printed;
|
||||
|
||||
list = g_slist_sort(object_class_get_list(TYPE_DEVICE, false),
|
||||
devinfo_cmp);
|
||||
list = object_class_get_list_sorted(TYPE_DEVICE, false);
|
||||
|
||||
for (i = 0; i <= DEVICE_CATEGORY_MAX; i++) {
|
||||
cat_printed = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue