diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2017-08-18 15:20:27 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-23 15:12:07 -0700 |
commit | 32b42e152fcc453273fadb5a7d639e4e9b506783 (patch) | |
tree | 263a76fc30d72df6178c00298dd91e7bfd92c724 /sha1_file.c | |
parent | pack: move {,re}prepare_packed_git and approximate_object_count (diff) | |
download | tgif-32b42e152fcc453273fadb5a7d639e4e9b506783.tar.xz |
pack: move unpack_object_header_buffer()
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/sha1_file.c b/sha1_file.c index 289eff2915..24f4249564 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -915,31 +915,6 @@ void *map_sha1_file(const unsigned char *sha1, unsigned long *size) return map_sha1_file_1(NULL, sha1, size); } -unsigned long unpack_object_header_buffer(const unsigned char *buf, - unsigned long len, enum object_type *type, unsigned long *sizep) -{ - unsigned shift; - unsigned long size, c; - unsigned long used = 0; - - c = buf[used++]; - *type = (c >> 4) & 7; - size = c & 15; - shift = 4; - while (c & 0x80) { - if (len <= used || bitsizeof(long) <= shift) { - error("bad object header"); - size = used = 0; - break; - } - c = buf[used++]; - size += (c & 0x7f) << shift; - shift += 7; - } - *sizep = size; - return used; -} - static int unpack_sha1_short_header(git_zstream *stream, unsigned char *map, unsigned long mapsize, void *buffer, unsigned long bufsiz) |