]> Git Repo - qemu.git/commitdiff
qom: introduce type_register_static_array()
authorIgor Mammedov <[email protected]>
Mon, 9 Oct 2017 19:50:49 +0000 (21:50 +0200)
committerDavid Gibson <[email protected]>
Mon, 16 Oct 2017 23:34:00 +0000 (10:34 +1100)
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 <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
include/qom/object.h
qom/object.c

index a707b677819128b120958476d0f776291e5d78b1..9a2369c67b7413dd6e4e183502ee7a78e77291c6 100644 (file)
@@ -788,6 +788,16 @@ Type type_register_static(const TypeInfo *info);
  */
 Type type_register(const TypeInfo *info);
 
+/**
+ * type_register_static_array:
+ * @infos: The array of the new type #TypeInfo structures.
+ * @nr_infos: number of entries in @infos
+ *
+ * @infos and all of the strings it points to should exist for the life time
+ * that the type is registered.
+ */
+void type_register_static_array(const TypeInfo *infos, int nr_infos);
+
 /**
  * object_class_dynamic_cast_assert:
  * @klass: The #ObjectClass to attempt to cast.
index 6a7bd9257b6e4c4e5376ec2e67657757b99b08ae..c58c52d518b16da2db93feee27e1633b1fc572d1 100644 (file)
@@ -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) {
This page took 0.033109 seconds and 4 git commands to generate.