[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/9] QemuOpts: Convert qemu_opts_foreach() to Er
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 5/9] QemuOpts: Convert qemu_opts_foreach() to Error |
Date: |
Tue, 02 Jun 2015 16:13:38 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
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