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 --- include/qom/object.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/qom/object.h') diff --git a/include/qom/object.h b/include/qom/object.h index 4f07090db0..96ce81bc5e 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -913,6 +913,17 @@ void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque), GSList *object_class_get_list(const char *implements_type, bool include_abstract); +/** + * object_class_get_list_sorted: + * @implements_type: The type to filter for, including its derivatives. + * @include_abstract: Whether to include abstract classes. + * + * Returns: A singly-linked list of the classes in alphabetical + * case-insensitive order. + */ +GSList *object_class_get_list_sorted(const char *implements_type, + bool include_abstract); + /** * object_ref: * @obj: the object -- cgit 1.4.1