提交 5bdb59a2 编写于 作者: M Markus Armbruster

pc: Use qemu_opt_set() instead of qemu_opts_parse()

Less code, same result.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 62b3de69
...@@ -1137,15 +1137,11 @@ void pc_acpi_init(const char *default_dsdt) ...@@ -1137,15 +1137,11 @@ void pc_acpi_init(const char *default_dsdt)
if (filename == NULL) { if (filename == NULL) {
fprintf(stderr, "WARNING: failed to find %s\n", default_dsdt); fprintf(stderr, "WARNING: failed to find %s\n", default_dsdt);
} else { } else {
char *arg; QemuOpts *opts = qemu_opts_create(qemu_find_opts("acpi"), NULL, 0,
QemuOpts *opts; &error_abort);
Error *err = NULL; Error *err = NULL;
arg = g_strdup_printf("file=%s", filename); qemu_opt_set(opts, "file", filename, &error_abort);
/* creates a deep copy of "arg" */
opts = qemu_opts_parse(qemu_find_opts("acpi"), arg, 0);
g_assert(opts != NULL);
acpi_table_add_builtin(opts, &err); acpi_table_add_builtin(opts, &err);
if (err) { if (err) {
...@@ -1153,7 +1149,6 @@ void pc_acpi_init(const char *default_dsdt) ...@@ -1153,7 +1149,6 @@ void pc_acpi_init(const char *default_dsdt)
error_get_pretty(err)); error_get_pretty(err));
error_free(err); error_free(err);
} }
g_free(arg);
g_free(filename); g_free(filename);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册