summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a7f0519)
raw | patch | inline | side by side (parent: a7f0519)
author | Shawn Pearce <spearce@spearce.org> | |
Sat, 26 Aug 2006 08:10:43 +0000 (04:10 -0400) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 27 Aug 2006 00:35:15 +0000 (17:35 -0700) |
This function was moved above unpack_delta_entry so we can call it
from within unpack_delta_entry without a forward declaration.
This change looks worse than it is. Its really just a relocation
of unpack_non_delta_entry to earlier in the file and renaming the
function to unpack_compressed_entry. No other changes were made.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
from within unpack_delta_entry without a forward declaration.
This change looks worse than it is. Its really just a relocation
of unpack_non_delta_entry to earlier in the file and renaming the
function to unpack_compressed_entry. No other changes were made.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
sha1_file.c | patch | blob | history |
diff --git a/sha1_file.c b/sha1_file.c
index 769a80984d25ca362acb8d7c4f97ac3526c2b753..53beb917dd5fadf8c1dddb86c3479a7f84438f71 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
return 0;
}
+static void *unpack_compressed_entry(unsigned char *data,
+ unsigned long size,
+ unsigned long left)
+{
+ int st;
+ z_stream stream;
+ unsigned char *buffer;
+
+ buffer = xmalloc(size + 1);
+ buffer[size] = 0;
+ memset(&stream, 0, sizeof(stream));
+ stream.next_in = data;
+ stream.avail_in = left;
+ stream.next_out = buffer;
+ stream.avail_out = size;
+
+ inflateInit(&stream);
+ st = inflate(&stream, Z_FINISH);
+ inflateEnd(&stream);
+ if ((st != Z_STREAM_END) || stream.total_out != size) {
+ free(buffer);
+ return NULL;
+ }
+
+ return buffer;
+}
+
static void *unpack_delta_entry(unsigned char *base_sha1,
unsigned long delta_size,
unsigned long left,
return result;
}
-static void *unpack_non_delta_entry(unsigned char *data,
- unsigned long size,
- unsigned long left)
-{
- int st;
- z_stream stream;
- unsigned char *buffer;
-
- buffer = xmalloc(size + 1);
- buffer[size] = 0;
- memset(&stream, 0, sizeof(stream));
- stream.next_in = data;
- stream.avail_in = left;
- stream.next_out = buffer;
- stream.avail_out = size;
-
- inflateInit(&stream);
- st = inflate(&stream, Z_FINISH);
- inflateEnd(&stream);
- if ((st != Z_STREAM_END) || stream.total_out != size) {
- free(buffer);
- return NULL;
- }
-
- return buffer;
-}
-
static void *unpack_entry(struct pack_entry *entry,
char *type, unsigned long *sizep)
{
return NULL;
}
*sizep = size;
- retval = unpack_non_delta_entry(pack, size, left);
+ retval = unpack_compressed_entry(pack, size, left);
return retval;
}