mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 11:08:25 +00:00
qapi: Smooth another visitor error checking pattern
Convert
visit_type_FOO(v, ..., &ptr, &err);
...
if (err) {
...
}
to
visit_type_FOO(v, ..., &ptr, errp);
...
if (!ptr) {
...
}
for functions that set @ptr to non-null / null on success / error.
Eliminate error_propagate() that are now unnecessary. Delete @err
that are now unused.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200707160613.848843-40-armbru@redhat.com>
This commit is contained in:
@@ -657,25 +657,18 @@ int monitor_init_opts(QemuOpts *opts, Error **errp)
|
||||
{
|
||||
Visitor *v;
|
||||
MonitorOptions *options;
|
||||
Error *local_err = NULL;
|
||||
int ret;
|
||||
|
||||
v = opts_visitor_new(opts);
|
||||
visit_type_MonitorOptions(v, NULL, &options, &local_err);
|
||||
visit_type_MonitorOptions(v, NULL, &options, errp);
|
||||
visit_free(v);
|
||||
|
||||
if (local_err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
monitor_init(options, true, &local_err);
|
||||
qapi_free_MonitorOptions(options);
|
||||
|
||||
out:
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
if (!options) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
ret = monitor_init(options, true, errp);
|
||||
qapi_free_MonitorOptions(options);
|
||||
return ret;
|
||||
}
|
||||
|
||||
QemuOptsList qemu_mon_opts = {
|
||||
|
||||
Reference in New Issue
Block a user