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

[PATCH 24/28] read-cache.c cleanup

From
DRDavid Rientjes <rientjes@google.com>
Date
Aug 14, 2006, 20:38 UTC
Message-ID
<Pine.LNX.4.63.0608141337420.19383@chino.corp.google.com>
Removes conditional returns.
		David
Signed-off-by: David Rientjes <rientjes@google.com>
---
 read-cache.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index c923a32..b18f9f7 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -880,10 +880,8 @@ static int write_index_ext_header(SHA_CT
 {
 	ext = htonl(ext);
 	sz = htonl(sz);
-	if ((ce_write(context, fd, &ext, 4) < 0) ||
-	    (ce_write(context, fd, &sz, 4) < 0))
-		return -1;
-	return 0;
+	return ((ce_write(context, fd, &ext, 4) < 0) ||
+		(ce_write(context, fd, &sz, 4) < 0)) ? -1 : 0;
 }
 
 static int ce_flush(SHA_CTX *context, int fd)
@@ -905,9 +903,7 @@ static int ce_flush(SHA_CTX *context, in
 	/* Append the SHA1 signature at the end */
 	SHA1_Final(write_buffer + left, context);
 	left += 20;
-	if (write(fd, write_buffer, left) != left)
-		return -1;
-	return 0;
+	return (write(fd, write_buffer, left) != left) ? -1 : 0;
 }
 
 static void ce_smudge_racily_clean_entry(struct cache_entry *ce)
-- 
1.4.2.g89bb-dirty
Message 1 of 1 in “read-cache.c cleanup”
  1. 24/28 read-cache.c cleanupDavid Rientjes, Aug 14, 2006

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.