git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Cleanup in sha1_file.c::cache_or_unpack_entry()

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Oct 9, 2008, 00:11 UTC
Message-ID
<1223511084-3472-1-git-send-email-vmiklos@frugalware.org>

This patch just removes an unnecessary goto which makes the code easier to read and shorter.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 sha1_file.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 7515987..ea6bd99 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1571,11 +1571,9 @@ static void *cache_or_unpack_entry(struct packed_git *p, off_t base_offset,
 	struct delta_base_cache_entry *ent = delta_base_cache + hash;
 
 	ret = ent->data;
-	if (ret && ent->p == p && ent->base_offset == base_offset)
-		goto found_cache_entry;
-	return unpack_entry(p, base_offset, type, base_size);
+	if (!ret || ent->p != p || ent->base_offset != base_offset)
+		return unpack_entry(p, base_offset, type, base_size);
 
-found_cache_entry:
 	if (!keep_cache) {
 		ent->data = NULL;
 		ent->lru.next->prev = ent->lru.prev;
-- 
1.6.0.2
Message 1 of 1 in “Cleanup in sha1_file.c::cache_or_unpack_entry()”
  1. Cleanup in sha1_file.c::cache_or_unpack_entry()Miklos Vajna, Oct 9, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.