diff options
author | Eric Blake <eblake@redhat.com> | 2015-12-01 22:20:52 -0700 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-12-17 08:21:29 +0100 |
commit | 5cdc8831a795fb8452d7e34f644202fd724e122a (patch) | |
tree | ed3741502d2d42dfda844d45beedf4307168eaad /qapi/string-input-visitor.c | |
parent | d00341af384665d259af475b14c96bb8414df415 (diff) | |
download | qemu-5cdc8831a795fb8452d7e34f644202fd724e122a.tar.gz qemu-5cdc8831a795fb8452d7e34f644202fd724e122a.tar.bz2 qemu-5cdc8831a795fb8452d7e34f644202fd724e122a.zip |
qapi: Simplify visits of optional fields
None of the visitor callbacks would set an error when testing
if an optional field was present; make this part of the interface
contract by eliminating the errp argument.
The resulting generated code has a nice diff:
|- visit_optional(v, &has_fdset_id, "fdset-id", &err);
|- if (err) {
|- goto out;
|- }
|+ visit_optional(v, &has_fdset_id, "fdset-id");
| if (has_fdset_id) {
| visit_type_int(v, &fdset_id, "fdset-id", &err);
| if (err) {
| goto out;
| }
| }
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1449033659-25497-9-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'qapi/string-input-visitor.c')
-rw-r--r-- | qapi/string-input-visitor.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index bbd6a5456c..dee780a2da 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -299,8 +299,7 @@ static void parse_type_number(Visitor *v, double *obj, const char *name, *obj = val; } -static void parse_optional(Visitor *v, bool *present, const char *name, - Error **errp) +static void parse_optional(Visitor *v, bool *present, const char *name) { StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v); |