From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzmws-00030F-Si for qemu-devel@nongnu.org; Tue, 02 Jun 2015 10:13:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yzmwo-00053I-Bm for qemu-devel@nongnu.org; Tue, 02 Jun 2015 10:13:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzmwo-000539-67 for qemu-devel@nongnu.org; Tue, 02 Jun 2015 10:13:42 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id CE8058E670 for ; Tue, 2 Jun 2015 14:13:41 +0000 (UTC) Message-ID: <556DBA12.9050308@redhat.com> Date: Tue, 02 Jun 2015 16:13:38 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1432815695-31687-1-git-send-email-armbru@redhat.com> <1432815695-31687-6-git-send-email-armbru@redhat.com> <55673FC2.8040804@redhat.com> <878uc2cpk9.fsf@blackfin.pond.sub.org> <556DA2DF.3010809@redhat.com> In-Reply-To: <556DA2DF.3010809@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/9] QemuOpts: Convert qemu_opts_foreach() to Error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , Markus Armbruster Cc: qemu-devel@nongnu.org On 02/06/2015 14:34, Eric Blake wrote: > Or, you could do: > > if (!errp) { errp = &error_abort; } ... if (rc) { return rc; } > assert(!*errp); > > and not have to use error_propagate() - either the caller is > tracking errors, or the caller passed NULL because they are > tracking return value and we can assume that their callback will > not raise errors (even on negative returns). But that's a slightly > different contract. > > You're right that the possibility of NULL makes it not as trivial > as I first thought, so I'm starting to waffle on whether enforcing > the contract is worth the extra lines of code. Anyone else with an > opinion? I think the simplest code is the best. :) Our error propagation at last works surprisingly well, but can already be pretty heavy on boilerplate... Paolo