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