Re: [PATCH 4/8] refs: make errno output explicit for refs_resolve_ref_unsafe
From: Han-Wen Nienhuys <hidden>
Date: 2021-06-10 11:27:36
On Thu, Jun 3, 2021 at 4:51 AM Jonathan Tan [off-list ref] wrote:
quoted
This introduces refs_resolve_ref_unsafe_with_errno(), which makes the API contract for the errno output explicit. The implementation still relies on the global errno variable to ensure no side effects.Looking at the next few patches, I think the plan is: - Introduce a new function refs_resolve_ref_unsafe_with_errno() which returns the error information in an out param instead of errno. Right now, it wraps refs_resolve_ref_unsafe(). - Migrate all callers that require the error information to refs_resolve_ref_unsafe_with_errno(), and leave all callers that do not require the error information alone (that is, using refs_resolve_ref_unsafe()). - To ensure that all callers using refs_resolve_ref_unsafe() really do not use errno, set it to 0. (This is allowed by the errno contract - successes can set errno to whatever they want.) If this is the plan, it should be written in the commit message.
I added more description to the commit message.
As it is, this patch handles the first and maybe part of the second step, and patch 5 handles the rest of the second step? I think the patches should be more clearly divided.
Done. -- Han-Wen Nienhuys - Google Munich I work 80%. Don't expect answers from me on Fridays. -- Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Paul Manicle, Halimah DeLaine Prado