diff options
author | Eric Blake <eblake@redhat.com> | 2015-12-01 22:20:52 -0700 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:28:19 -0600 |
commit | 1e741644ef4d9926705d251d6992f7e575a277f3 (patch) | |
tree | cb11fefcba0aa7e635d281249e5480fad31eaa83 /include/qapi/visitor-impl.h | |
parent | 579ce02dc1dadfb2a98e2f9d62ec0228f5dad6fa (diff) | |
download | hqemu-1e741644ef4d9926705d251d6992f7e575a277f3.zip hqemu-1e741644ef4d9926705d251d6992f7e575a277f3.tar.gz |
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 'include/qapi/visitor-impl.h')
-rw-r--r-- | include/qapi/visitor-impl.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h index 7419684..44a21b7 100644 --- a/include/qapi/visitor-impl.h +++ b/include/qapi/visitor-impl.h @@ -44,9 +44,8 @@ struct Visitor void (*type_any)(Visitor *v, QObject **obj, const char *name, Error **errp); - /* May be NULL */ - void (*optional)(Visitor *v, bool *present, const char *name, - Error **errp); + /* May be NULL; most useful for input visitors. */ + void (*optional)(Visitor *v, bool *present, const char *name); void (*type_uint8)(Visitor *v, uint8_t *obj, const char *name, Error **errp); void (*type_uint16)(Visitor *v, uint16_t *obj, const char *name, Error **errp); |