Eric Blake <ebl...@redhat.com> writes:

> 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;
> |-    }
> |-    if (has_fdset_id) {
> |+    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;
> |         }
> |     }

I think this should be

  |-    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: Eric Blake <ebl...@redhat.com>

Patch looks good.

Reply via email to