Thread (1 message) 1 message, 1 author, 2021-07-06

Re: [PATCH v4 4/6] refs: add failure_errno to refs_read_raw_ref() signature

From: Junio C Hamano <hidden>
Date: 2021-07-06 19:39:04
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

"Han-Wen Nienhuys via GitGitGadget" [off-list ref] writes:
-int refs_read_raw_ref(struct ref_store *ref_store,
-		      const char *refname, struct object_id *oid,
-		      struct strbuf *referent, unsigned int *type)
+int refs_read_raw_ref(struct ref_store *ref_store, const char *refname,
+		      struct object_id *oid, struct strbuf *referent,
+		      unsigned int *type, int *failure_errno)
 {
-	int result;
-	int failure_errno;
+	int ignore;
+	if (failure_errno)
+		*failure_errno = 0;
+	else
+		failure_errno = &ignore;
+
Same comment as v3(v5).  Squashable fix-up follows.
diff --git a/refs.c b/refs.c
index eca7310e7a..aaea9b34c6 100644
--- a/refs.c
+++ b/refs.c
@@ -1677,11 +1677,11 @@ int refs_read_raw_ref(struct ref_store *ref_store, const char *refname,
 		      struct object_id *oid, struct strbuf *referent,
 		      unsigned int *type, int *failure_errno)
 {
-	int ignore;
-	if (failure_errno)
-		*failure_errno = 0;
-	else
-		failure_errno = &ignore;
+	int unused_errno;
+
+	if (!failure_errno)
+		failure_errno = &unused_errno;
+	*failure_errno = 0;
 
 	if (!strcmp(refname, "FETCH_HEAD") || !strcmp(refname, "MERGE_HEAD")) {
 		return refs_read_special_head(ref_store, refname, oid, referent,
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help