From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz7sf-0000AM-1N for qemu-devel@nongnu.org; Wed, 18 Nov 2015 13:54:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zz7sa-0002qi-0R for qemu-devel@nongnu.org; Wed, 18 Nov 2015 13:54:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35098) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz7sZ-0002qb-Ma for qemu-devel@nongnu.org; Wed, 18 Nov 2015 13:54:51 -0500 From: Markus Armbruster References: <1447836791-369-1-git-send-email-eblake@redhat.com> <1447836791-369-36-git-send-email-eblake@redhat.com> Date: Wed, 18 Nov 2015 19:54:49 +0100 In-Reply-To: <1447836791-369-36-git-send-email-eblake@redhat.com> (Eric Blake's message of "Wed, 18 Nov 2015 01:53:10 -0700") Message-ID: <87twoji1dy.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v12 35/36] qapi: Simplify visits of optional fields List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Michael Roth Eric Blake 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 Patch looks good.