From 47c66009ab793241e8210b3018c77a9ce9506aa8 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 3 Mar 2018 08:33:10 +0100 Subject: qom: introduce object_class_get_list_sorted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Signed-off-by: Paolo Bonzini --- qdev-monitor.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'qdev-monitor.c') diff --git a/qdev-monitor.c b/qdev-monitor.c index b7e3291..61e0300 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -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; -- cgit v1.1