summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-03-24 17:26:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-24 19:34:07 (GMT)
commit2c5e2865cc3dfc053e71510415f479e165119d04 (patch)
treeb718bd9758d66b6c8fc9b87f20d985bef6244df0 /builtin
parent7202a6fa8773fdcf3f374625def3c15276250b67 (diff)
downloadgit-2c5e2865cc3dfc053e71510415f479e165119d04.zip
git-2c5e2865cc3dfc053e71510415f479e165119d04.tar.gz
git-2c5e2865cc3dfc053e71510415f479e165119d04.tar.bz2
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 'builtin')
-rw-r--r--builtin/pack-objects.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 463f30b..28e7498 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -239,7 +239,8 @@ static unsigned long write_no_reuse_object(struct sha1file *f, struct object_ent
unsigned long limit, int usable_delta)
{
unsigned long size, datalen;
- unsigned char header[10], dheader[10];
+ unsigned char header[MAX_PACK_OBJECT_HEADER],
+ dheader[MAX_PACK_OBJECT_HEADER];
unsigned hdrlen;
enum object_type type;
void *buf;
@@ -353,7 +354,8 @@ static off_t write_reuse_object(struct sha1file *f, struct object_entry *entry,
off_t offset;
enum object_type type = entry->type;
off_t datalen;
- unsigned char header[10], dheader[10];
+ unsigned char header[MAX_PACK_OBJECT_HEADER],
+ dheader[MAX_PACK_OBJECT_HEADER];
unsigned hdrlen;
if (entry->delta)