qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v12 35/36] qapi: Simplify visits of optional fie


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v12 35/36] qapi: Simplify visits of optional fields
Date: Wed, 18 Nov 2015 19:54:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eric Blake <address@hidden> 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 <address@hidden>

Patch looks good.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]