Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/pack.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-03-24 20:26:50 +0300
committerJunio C Hamano <gitster@pobox.com>2017-03-24 22:34:07 +0300
commit2c5e2865cc3dfc053e71510415f479e165119d04 (patch)
treeb718bd9758d66b6c8fc9b87f20d985bef6244df0 /pack.h
parent7202a6fa8773fdcf3f374625def3c15276250b67 (diff)
pack.h: define largest possible encoded object size
Several callers use fixed buffers for storing the pack object header, and they've picked 10 as a magic number. This is reasonable, since it handles objects up to 2^67. But let's give them a constant so it's clear that the number isn't pulled out of thin air. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack.h')
-rw-r--r--pack.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/pack.h b/pack.h
index 87e456d5ea..5c2158746e 100644
--- a/pack.h
+++ b/pack.h
@@ -84,6 +84,12 @@ extern int verify_pack(struct packed_git *, verify_fn fn, struct progress *, uin
extern off_t write_pack_header(struct sha1file *f, uint32_t);
extern void fixup_pack_header_footer(int, unsigned char *, const char *, uint32_t, unsigned char *, off_t);
extern char *index_pack_lockfile(int fd);
+
+/*
+ * The "hdr" output buffer should be at least this big, which will handle sizes
+ * up to 2^67.
+ */
+#define MAX_PACK_OBJECT_HEADER 10
extern int encode_in_pack_object_header(unsigned char *hdr, int hdr_len,
enum object_type, uintmax_t);