diff options
author | Eric Blake <eblake@redhat.com> | 2016-01-29 06:48:48 -0700 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-02-08 17:29:55 +0100 |
commit | 7c91aabd8964cfdf637f302c579c95401f21ce92 (patch) | |
tree | 7f38a8fe67ef887bd1ac6c6d61330737c4fd0389 /qapi | |
parent | 92b09babc11b60458c28cfe37eaa314de50e6241 (diff) | |
download | qemu-7c91aabd8964cfdf637f302c579c95401f21ce92.zip qemu-7c91aabd8964cfdf637f302c579c95401f21ce92.tar.gz qemu-7c91aabd8964cfdf637f302c579c95401f21ce92.tar.bz2 |
qapi-visit: Kill unused visit_end_union()
The generated code can call visit_end_union() without having called
visit_start_union(). Example:
if (!*obj) {
goto out_obj;
}
visit_type_CpuInfoBase_fields(v, (CpuInfoBase **)obj, &err);
if (err) {
goto out_obj; // if we go from here...
}
if (!visit_start_union(v, !!(*obj)->u.data, &err) || err) {
goto out_obj;
}
switch ((*obj)->arch) {
[...]
}
out_obj:
// ... then *obj is true, and ...
error_propagate(errp, err);
err = NULL;
if (*obj) {
// we end up here
visit_end_union(v, !!(*obj)->u.data, &err);
}
error_propagate(errp, err);
Harmless only because no visitor implements end_union(). Clean it up
anyway, by deleting the function as useless.
Messed up since we have visit_end_union (commit cee2ded).
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1453902888-20457-3-git-send-email-armbru@redhat.com>
[expand scope of patch to delete rather than repair]
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1454075341-13658-13-git-send-email-eblake@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r-- | qapi/qapi-visit-core.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 8473d3c..060316b 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -1,6 +1,7 @@ /* * Core Definitions for QAPI Visitor Classes * + * Copyright (C) 2012-2016 Red Hat, Inc. * Copyright IBM, Corp. 2011 * * Authors: @@ -67,13 +68,6 @@ bool visit_start_union(Visitor *v, bool data_present, Error **errp) return true; } -void visit_end_union(Visitor *v, bool data_present, Error **errp) -{ - if (v->end_union) { - v->end_union(v, data_present, errp); - } -} - bool visit_optional(Visitor *v, bool *present, const char *name) { if (v->optional) { |