qapi: Clean up null checking in generated visitors
authorMarkus Armbruster <armbru@redhat.com>
Sat, 1 Mar 2014 07:40:37 +0000 (08:40 +0100)
committerLuiz Capitulino <lcapitulino@redhat.com>
Mon, 3 Mar 2014 16:17:20 +0000 (11:17 -0500)
commit949ceeb31b84dce43e4619b6d7f02cac0e62e1e1
treefbd613c5373975792434e31a02e760f78bd6031d
parent56bed4135f139721d42992da3924786282bb0286
qapi: Clean up null checking in generated visitors

Visitors get passed a pointer to the visited object.  The generated
visitors try to cope with this pointer being null in some places, for
instance like this:

    visit_start_optional(m, obj ? &(*obj)->has_name : NULL, "name", &err);

visit_start_optional() passes its second argument to Visitor method
start_optional.  Three out of three methods dereference it
unconditionally.

I fail to see how this pointer could legitimately be null.

All this useless null checking is highly redundant, which Coverity
duly reports.  About 200 times.

Remove the useless null checks.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
scripts/qapi-visit.py