« Previous | Next » 

Revision 949ceeb3

ID949ceeb31b84dce43e4619b6d7f02cac0e62e1e1

Added by Markus Armbruster about 10 years ago

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 <>
Reviewed-by: Eric Blake <>
Signed-off-by: Luiz Capitulino <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences