Skip to content
  • Eric Blake's avatar
    5cdc8831
    qapi: Simplify visits of optional fields · 5cdc8831
    Eric Blake authored
    
    
    None of the visitor callbacks would set an error when testing
    if an optional field was present; make this part of the interface
    contract by eliminating the errp argument.
    
    The resulting generated code has a nice diff:
    
    |-    visit_optional(v, &has_fdset_id, "fdset-id", &err);
    |-    if (err) {
    |-        goto out;
    |-    }
    |+    visit_optional(v, &has_fdset_id, "fdset-id");
    |     if (has_fdset_id) {
    |         visit_type_int(v, &fdset_id, "fdset-id", &err);
    |         if (err) {
    |             goto out;
    |         }
    |     }
    
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <1449033659-25497-9-git-send-email-eblake@redhat.com>
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    5cdc8831
    qapi: Simplify visits of optional fields
    Eric Blake authored
    
    
    None of the visitor callbacks would set an error when testing
    if an optional field was present; make this part of the interface
    contract by eliminating the errp argument.
    
    The resulting generated code has a nice diff:
    
    |-    visit_optional(v, &has_fdset_id, "fdset-id", &err);
    |-    if (err) {
    |-        goto out;
    |-    }
    |+    visit_optional(v, &has_fdset_id, "fdset-id");
    |     if (has_fdset_id) {
    |         visit_type_int(v, &fdset_id, "fdset-id", &err);
    |         if (err) {
    |             goto out;
    |         }
    |     }
    
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <1449033659-25497-9-git-send-email-eblake@redhat.com>
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
Loading