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

[PATCH 5/6] This assertion is valid for both loose and packed objects

From
HCHervé Cauwelier <herve@itaapy.com>
Date
Oct 14, 2009, 10:37 UTC
Message-ID
<1255516669-26745-5-git-send-email-herve@itaapy.com>
In-Reply-To
<1255516669-26745-4-git-send-email-herve@itaapy.com>
Signed-off-by: Hervé Cauwelier <herve@itaapy.com>
---
 src/odb.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/odb.c b/src/odb.c
index c71948b..a612299 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -1149,11 +1149,10 @@ void git_odb_close(git_odb *db)
 	free(db);
 }
 
-int git_odb_read(
-	git_obj *out,
-	git_odb *db,
-	const git_oid *id)
+int git_odb_read(git_obj *out, git_odb *db, const git_oid *id)
 {
+	assert(out && db && id);
+
 attempt:
 	if (!git_odb__read_packed(out, db, id))
 		return GIT_SUCCESS;
@@ -1171,8 +1170,6 @@ int git_odb__read_loose(git_obj *out, git_odb *db, const git_oid *id)
 	char file[GIT_PATH_MAX];
 	gitfo_buf obj = GITFO_BUF_INIT;
 
-	assert(out && db && id);
-
 	out->data = NULL;
 	out->len  = 0;
 	out->type = GIT_OBJ_BAD;
-- 
1.6.5
Previous: Hervé CauwelierNext: Hervé Cauwelier
Message 5 of 9 in “Open the pack file and keep a map on it.”
  1. 1/6 Open the pack file and keep a map on it.Hervé Cauwelier, Oct 14, 2009
  2. 2/6 Read the base offset or name of delta objectsHervé Cauwelier, Oct 14, 2009
  3. 3/6 Allow zlib to read a pack buffer longer than the actual dataHervé Cauwelier, Oct 14, 2009
  4. 4/6 Inflate an object from a pack fileHervé Cauwelier, Oct 14, 2009
  5. 5/6 This assertion is valid for both loose and packed objectsHervé Cauwelier, Oct 14, 2009
  6. 6/6 Read an object from a pack fileHervé Cauwelier, Oct 14, 2009
  7. Sverre RabbelierOct 14, 2009
  8. Hervé CauwelierOct 14, 2009
  9. Sverre RabbelierOct 14, 2009

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.