Signed-off-by: Markus Armbruster <arm...@redhat.com> Reviewed-by: Eric Blake <ebl...@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- vl.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/vl.c b/vl.c index 8e247cc..96c5da1 100644 --- a/vl.c +++ b/vl.c @@ -2855,6 +2855,14 @@ static bool object_create_delayed(const char *type) return !object_create_initial(type); } +static void object_create(bool (*type_predicate)(const char *)) +{ + if (qemu_opts_foreach(qemu_find_opts("object"), + user_creatable_add_opts_foreach, + type_predicate, NULL)) { + exit(1); + } +} static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size, MachineClass *mc) @@ -4391,11 +4399,7 @@ int main(int argc, char **argv, char **envp) page_size_init(); socket_init(); - if (qemu_opts_foreach(qemu_find_opts("object"), - user_creatable_add_opts_foreach, - object_create_initial, NULL)) { - exit(1); - } + object_create(object_create_initial); if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, NULL)) { @@ -4520,11 +4524,7 @@ int main(int argc, char **argv, char **envp) exit(1); } - if (qemu_opts_foreach(qemu_find_opts("object"), - user_creatable_add_opts_foreach, - object_create_delayed, NULL)) { - exit(1); - } + object_create(object_create_delayed); #ifdef CONFIG_TPM if (tpm_init() < 0) { -- 2.7.5