introduce qemu_opts_create_nofail function

While id is NULL, qemu_opts_create can not fail, so ignore
errors is fine.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Dong Xu Wang 2012-12-06 14:47:21 +08:00 committed by Kevin Wolf
parent ad718d01ba
commit dd39244978
2 changed files with 10 additions and 0 deletions

View File

@ -780,6 +780,15 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id,
return opts;
}
QemuOpts *qemu_opts_create_nofail(QemuOptsList *list)
{
QemuOpts *opts;
Error *errp = NULL;
opts = qemu_opts_create(list, NULL, 0, &errp);
assert_no_error(errp);
return opts;
}
void qemu_opts_reset(QemuOptsList *list)
{
QemuOpts *opts, *next_opts;

View File

@ -133,6 +133,7 @@ int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id);
QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id,
int fail_if_exists, Error **errp);
QemuOpts *qemu_opts_create_nofail(QemuOptsList *list);
void qemu_opts_reset(QemuOptsList *list);
void qemu_opts_loc_restore(QemuOpts *opts);
int qemu_opts_set(QemuOptsList *list, const char *id,