aboutsummaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2005-06-29 02:49:56 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-29 09:11:38 -0700
commitdcde55bc58ae845307efbdce3a1071f75ccd758e (patch)
treefc76dbd773c225cef239a0774304335c8116f2bc /sha1_file.c
parente5e3e0f5001f51fe388d530481e56651729add1a (diff)
downloadgit-dcde55bc58ae845307efbdce3a1071f75ccd758e.tar.gz
git-dcde55bc58ae845307efbdce3a1071f75ccd758e.tar.xz
[PATCH] assorted delta code cleanup
This is a wrap-up patch including all the cleanups I've done to the delta code and its usage. The most important change is the factorization of the delta header handling code. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/sha1_file.c b/sha1_file.c
index f6cf180bd..737ecb480 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -592,22 +592,6 @@ void * unpack_sha1_file(void *map, unsigned long mapsize, char *type, unsigned l
return unpack_sha1_rest(&stream, hdr, *size);
}
-static unsigned long parse_delta_size(unsigned char **p)
-{
- unsigned char c;
- unsigned long size = 0;
- unsigned shift = 0;
- unsigned char *data = *p;
-
- do {
- c = *data++;
- size += (c & 0x7f) << shift;
- shift += 7;
- } while (c & 0x80);
- *p = data;
- return size;
-}
-
static int packed_delta_info(unsigned char *base_sha1,
unsigned long delta_size,
unsigned long left,
@@ -645,11 +629,12 @@ static int packed_delta_info(unsigned char *base_sha1,
* the result size. Verify the base size while we are at it.
*/
data = delta_head;
- verify_base_size = parse_delta_size(&data);
- result_size = parse_delta_size(&data);
+ verify_base_size = get_delta_hdr_size(&data);
if (verify_base_size != base_size)
die("delta base size mismatch");
+ /* Read the result size */
+ result_size = get_delta_hdr_size(&data);
*sizep = result_size;
return 0;
}