Thread (29 messages) 29 messages, 5 authors, 2017-05-17

Re: [PATCH v3 04/12] refs.c: refactor get_submodule_ref_store(), share common free block

From: Michael Haggerty <hidden>
Date: 2017-04-22 05:14:03

On 04/19/2017 01:01 PM, Nguyễn Thái Ngọc Duy wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 refs.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/refs.c b/refs.c
index 5d31fb6bcf..5902a3d9e5 100644
--- a/refs.c
+++ b/refs.c
@@ -1570,19 +1570,16 @@ struct ref_store *get_submodule_ref_store(const char *submodule)
 
 	refs = lookup_ref_store_map(&submodule_ref_stores, submodule);
 	if (refs)
-		return refs;
+		goto done;
 
 	strbuf_addstr(&submodule_sb, submodule);
 	ret = is_nonbare_repository_dir(&submodule_sb);
-	strbuf_release(&submodule_sb);
 	if (!ret)
-		return NULL;
+		goto done;
 
 	ret = submodule_to_gitdir(&submodule_sb, submodule);
-	if (ret) {
-		strbuf_release(&submodule_sb);
-		return NULL;
-	}
+	if (ret)
+		goto done;
After this change, the temporary variable `ret` could be eliminated.
[...]
Michael
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help