Re: [PATCH 6/8] refs: clear errno return in refs_resolve_ref_unsafe()
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Jun 3, 2021, 02:53 UTC
- Message-ID
- <20210603025340.349224-1-jonathantanmy@google.com>
- In-Reply-To
- <1bb350ea5d21eacf95426192c89173b502b7e06a.1619710329.git.gitgitgadget@gmail.com>
Show 13 quoted lines
> @@ -1685,10 +1685,11 @@ int refs_read_raw_ref(struct ref_store *ref_store, const char *refname, > } > > /* This function needs to return a meaningful errno on failure */ > -const char *refs_resolve_ref_unsafe(struct ref_store *refs, > - const char *refname, > - int resolve_flags, > - struct object_id *oid, int *flags) > +static const char *refs_resolve_ref_unsafe_errno(struct ref_store *refs, > + const char *refname, > + int resolve_flags, > + struct object_id *oid, > + int *flags)
So a third function (refs_resolve_ref_unsafe_errno() - not to be confused with refs_resolve_ref_unsafe_with_errno(), which has an extra "with")? Couldn't we just swap the other 2 functions directly instead of going through this intermediary?
Show 9 quoted lines
> +const char *refs_resolve_ref_unsafe(struct ref_store *refs, const char *refname,
> + int resolve_flags, struct object_id *oid,
> + int *flags)
> +{
> + const char *result = refs_resolve_ref_unsafe_errno(
> + refs, refname, resolve_flags, oid, flags);
> + errno = 0;
> + return result;
> +}This is the errno = 0 part that I was talking about in my review of patch 4.