summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-03-22 12:51:06 +0100
committerLuiz Capitulino <lcapitulino@redhat.com>2012-03-27 09:13:57 -0300
commitb6f0474fc0fe6f81d93d620a5d24bc30b22d561b (patch)
treec91eb419098ef4529f497f0db7af77c51ef4f91e /scripts
parent8b714d3747e6870db85dd9382adb8ee371633092 (diff)
qapi: shortcut visits on errors
We can exit very soon if we enter a visitor with a preexisting error. This simplifies some cases because we will not have to deal with obj being non-NULL while *obj is NULL. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi-visit.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 78c947cd9c..4297621762 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -61,6 +61,9 @@ def generate_visit_struct(name, members):
void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **errp)
{
+ if (error_is_set(errp)) {
+ return;
+ }
visit_start_struct(m, (void **)obj, "%(name)s", name, sizeof(%(name)s), errp);
''',
name=name)
@@ -81,6 +84,9 @@ void visit_type_%(name)sList(Visitor *m, %(name)sList ** obj, const char *name,
{
GenericList *i, **head = (GenericList **)obj;
+ if (error_is_set(errp)) {
+ return;
+ }
visit_start_list(m, name, errp);
for (*head = i = visit_next_list(m, head, errp); i; i = visit_next_list(m, &i, errp)) {
@@ -112,6 +118,9 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **
{
Error *err = NULL;
+ if (error_is_set(errp)) {
+ return;
+ }
visit_start_struct(m, (void **)obj, "%(name)s", name, sizeof(%(name)s), &err);
visit_type_%(name)sKind(m, &(*obj)->kind, "type", &err);
if (err) {