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

[PATCH 1/4] write_idx_file should use an unsigned nr_objects parameter

From
Dan McGee <dpmcgee@gmail.com>
Date
Mar 31, 2011, 01:24 UTC
Message-ID
<1301534674-31981-1-git-send-email-dpmcgee@gmail.com>

This follows the precedent set in the pack-objects code and being adjusted for in index-pack and unpack-objects.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
 pack-write.c |    6 +++---
 pack.h       |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/pack-write.c b/pack-write.c
index a905ca4..c2de03a 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -18,15 +18,15 @@ static int sha1_compare(const void *_a, const void *_b)
  * will be sorted by SHA1 on exit.
  */
 const char *write_idx_file(const char *index_name, struct pack_idx_entry **objects,
-			   int nr_objects, unsigned char *sha1)
+			   uint32_t nr_objects, unsigned char *sha1)
 {
 	struct sha1file *f;
 	struct pack_idx_entry **sorted_by_sha, **list, **last;
 	off_t last_obj_offset = 0;
 	uint32_t array[256];
-	int i, fd;
+	uint32_t i, index_version;
+	int fd;
 	git_SHA_CTX ctx;
-	uint32_t index_version;
 
 	if (nr_objects) {
 		sorted_by_sha = objects;
diff --git a/pack.h b/pack.h
index bb27576..c588454 100644
--- a/pack.h
+++ b/pack.h
@@ -55,7 +55,7 @@ struct pack_idx_entry {
 	off_t offset;
 };
 
-extern const char *write_idx_file(const char *index_name, struct pack_idx_entry **objects, int nr_objects, unsigned char *sha1);
+extern const char *write_idx_file(const char *index_name, struct pack_idx_entry **objects, uint32_t nr_objects, unsigned char *sha1);
 extern int check_pack_crc(struct packed_git *p, struct pack_window **w_curs, off_t offset, off_t len, unsigned int nr);
 extern int verify_pack_index(struct packed_git *);
 extern int verify_pack(struct packed_git *);
-- 
1.7.4.2
Next: Dan McGee
Message 1 of 6 in “write_idx_file should use an unsigned nr_objects parameter”
  1. 1/4 write_idx_file should use an unsigned nr_objects parameterDan McGee, Mar 31, 2011
  2. 2/4 Use uint32_t for unpack-objects countersDan McGee, Mar 31, 2011
  3. 3/4 Use uint32_t for index-pack countersDan McGee, Mar 31, 2011
  4. 4/4 Unify pack header checking between index-pack and unpack-objectsDan McGee, Mar 31, 2011
  5. Junio C HamanoApr 1, 2011
  6. Dan McGeeApr 1, 2011

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.