Commit e36c714e authored by Eric Blake's avatar Eric Blake Committed by Markus Armbruster
Browse files

qapi: Consistent generated code: prefer common indentation



We had some pointless differences in the generated code for visit,
command marshalling, and events; unifying them makes it easier for
future patches to consolidate to common helper functions.
This is one patch of a series to clean up these differences.

This patch adjusts gen_visit_union() to use the same indentation
as other functions, namely, by jumping early to the error label
if the object was not set rather than placing the rest of the
body inside an if for when it is set.

No change in semantics to the generated code.

Signed-off-by: default avatarEric Blake <eblake@redhat.com>
Message-Id: <1443565276-4535-14-git-send-email-eblake@redhat.com>
Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
parent f782399c
Loading
Loading
Loading
Loading
+27 −26
Original line number Diff line number Diff line
@@ -264,7 +264,9 @@ void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error
    if (err) {
        goto out;
    }
    if (*obj) {
    if (!*obj) {
        goto out_obj;
    }
''',
                 c_name=c_name(name), name=name)

@@ -332,7 +334,6 @@ out_obj:
    visit_end_union(v, !!(*obj)->data, &err);
    error_propagate(errp, err);
    err = NULL;
    }
    visit_end_struct(v, &err);
out:
    error_propagate(errp, err);