summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-03-17 12:42:15 -0700
committerJunio C Hamano <junkio@cox.net>2007-03-18 15:36:59 -0700
commit62f255ad586a987461c96b1da123da5e2cc3f619 (patch)
tree2427f06f83239c95c28979a1b9583426bde042b8 /sha1_file.c
parent5bb44a51038a18f4f940968aed84e6cc26afcebe (diff)
downloadgit-62f255ad586a987461c96b1da123da5e2cc3f619.tar.gz
Make trivial wrapper functions around delta base generation and freeing
This doesn't change any code, it just creates a point for where we'd actually do the caching of delta bases that have been generated. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 110d696213..f11ca3fbac 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1352,6 +1352,18 @@ static void *unpack_compressed_entry(struct packed_git *p,
return buffer;
}
+static void *cache_or_unpack_entry(struct packed_git *p, off_t base_offset,
+ unsigned long *base_size, enum object_type *type)
+{
+ return unpack_entry(p, base_offset, type, base_size);
+}
+
+static void add_delta_base_cache(struct packed_git *p, off_t base_offset,
+ void *base, unsigned long base_size, enum object_type type)
+{
+ free(base);
+}
+
static void *unpack_delta_entry(struct packed_git *p,
struct pack_window **w_curs,
off_t curpos,
@@ -1365,7 +1377,7 @@ static void *unpack_delta_entry(struct packed_git *p,
off_t base_offset;
base_offset = get_delta_base(p, w_curs, &curpos, *type, obj_offset);
- base = unpack_entry(p, base_offset, type, &base_size);
+ base = cache_or_unpack_entry(p, base_offset, &base_size, type);
if (!base)
die("failed to read delta base object"
" at %"PRIuMAX" from %s",
@@ -1378,7 +1390,7 @@ static void *unpack_delta_entry(struct packed_git *p,
if (!result)
die("failed to apply delta");
free(delta_data);
- free(base);
+ add_delta_base_cache(p, base_offset, base, base_size, *type);
return result;
}