From b11a093c6025635b4504d79d30daa334a01279a5 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 7 Jul 2020 18:06:07 +0200 Subject: 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 Reviewed-by: Eric Blake Message-Id: <20200707160613.848843-40-armbru@redhat.com> --- monitor/monitor.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'monitor/monitor.c') diff --git a/monitor/monitor.c b/monitor/monitor.c index 19dcb8fbe3..b385a3d569 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -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; + if (!options) { + return -1; } - monitor_init(options, true, &local_err); + ret = monitor_init(options, true, errp); qapi_free_MonitorOptions(options); - -out: - if (local_err) { - error_propagate(errp, local_err); - return -1; - } - return 0; + return ret; } QemuOptsList qemu_mon_opts = { -- cgit v1.2.3