On 03.09.25 07:04, Jason Wang wrote:
On Sun, Aug 24, 2025 at 12:03 AM Vladimir Sementsov-Ogievskiy
<vsement...@yandex-team.ru> wrote:
To avoid error propagation, let's follow common recommendation to
use return value together with errp.
It would be better to have some words or links to explain why we need
to avoid error propagation.
In short with additional return value we get:
- less code to handle error
- don't create and set Error object when it's not required (when passed
errp=NULL)
More details in commit message of e3fe3988d7851cac3 "error: Document Error API usage
rules".
I'll add this information here.
Probably, it would also be good to use bool as a return type
(switching to true/false as success/failure instead of 0/-1). But
seems almost all functions (including a lot of them with errp
argument) have 0/-1 semantics in net/, so making exclusions doesn't
seem good. If we want such a switch, we should update the whole
net/ directory.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@yandex-team.ru>
---
Thanks
--
Best regards,
Vladimir