From aa04c9d20704fa5b9ab239d5111adbcce5f49808 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 9 Oct 2017 21:50:49 +0200 Subject: qom: introduce type_register_static_array() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it will help to remove code duplication of registration static types in places that have open coded loop to perform batch type registering. Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: David Gibson Signed-off-by: David Gibson --- qom/object.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'qom') diff --git a/qom/object.c b/qom/object.c index 6a7bd9257b..c58c52d518 100644 --- a/qom/object.c +++ b/qom/object.c @@ -151,6 +151,15 @@ TypeImpl *type_register_static(const TypeInfo *info) return type_register(info); } +void type_register_static_array(const TypeInfo *infos, int nr_infos) +{ + int i; + + for (i = 0; i < nr_infos; i++) { + type_register_static(&infos[i]); + } +} + static TypeImpl *type_get_by_name(const char *name) { if (name == NULL) { -- cgit v1.2.3-70-g09d2