summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 55bb5c9)
raw | patch | inline | side by side (parent: 55bb5c9)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 10 Jun 2011 18:18:17 +0000 (11:18 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 10 Jun 2011 18:18:17 +0000 (11:18 -0700) |
Signed-off-by: Junio C Hamano <gitster@pobox.com>
archive-zip.c | patch | blob | history | |
builtin/pack-objects.c | patch | blob | history | |
cache.h | patch | blob | history | |
diff.c | patch | blob | history | |
fast-import.c | patch | blob | history | |
http-push.c | patch | blob | history | |
remote-curl.c | patch | blob | history | |
zlib.c | patch | blob | history |
diff --git a/archive-zip.c b/archive-zip.c
index 081ff830c8b2345d2cf843f07496365934da0d6b..8fbac2741aad958272f05cb9db02b5915a195ffb 100644 (file)
--- a/archive-zip.c
+++ b/archive-zip.c
memset(&stream, 0, sizeof(stream));
git_deflate_init(&stream, compression_level);
- maxsize = deflateBound(&stream, size);
+ maxsize = git_deflate_bound(&stream, size);
buffer = xmalloc(maxsize);
stream.next_in = data;
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 61f975585daf6fb28d635ce2899c2e5085dbb9d9..8981dd60669b14ed25449b6afde9a1526bb813c0 100644 (file)
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
memset(&stream, 0, sizeof(stream));
git_deflate_init(&stream, pack_compression_level);
- maxsize = deflateBound(&stream, size);
+ maxsize = git_deflate_bound(&stream, size);
in = *pptr;
out = xmalloc(maxsize);
index 5eb61ac04ef7cdab4050db243aa226b4302ba56d..85ac5ec17c9cf4a8dfd725e1f871be8ec4fef867 100644 (file)
--- a/cache.h
+++ b/cache.h
#endif
#include <zlib.h>
-#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200
-#define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
-#endif
void git_inflate_init(z_streamp strm);
void git_inflate_init_gzip_only(z_streamp strm);
void git_deflate_end(z_streamp strm);
int git_deflate_end_gently(z_streamp strm);
int git_deflate(z_streamp strm, int flush);
+unsigned long git_deflate_bound(z_streamp, unsigned long);
#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
#define DTYPE(de) ((de)->d_type)
index c15c70f977150e6f8ac9d1d4d468c9592a2b059e..bac9a4bc22f96fd284a89c8c33a183672da3361b 100644 (file)
--- a/diff.c
+++ b/diff.c
memset(&stream, 0, sizeof(stream));
git_deflate_init(&stream, zlib_compression_level);
- bound = deflateBound(&stream, size);
+ bound = git_deflate_bound(&stream, size);
deflated = xmalloc(bound);
stream.next_out = deflated;
stream.avail_out = bound;
diff --git a/fast-import.c b/fast-import.c
index 42979e6db05a2f23bfdc76c923215906d61ddacc..e4116a4ace927f2d6fb323a654130863ed047dff 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
s.next_in = (void *)dat->buf;
s.avail_in = dat->len;
}
- s.avail_out = deflateBound(&s, s.avail_in);
+ s.avail_out = git_deflate_bound(&s, s.avail_in);
s.next_out = out = xmalloc(s.avail_out);
while (git_deflate(&s, Z_FINISH) == Z_OK)
; /* nothing */
git_deflate_init(&s, pack_compression_level);
s.next_in = (void *)dat->buf;
s.avail_in = dat->len;
- s.avail_out = deflateBound(&s, s.avail_in);
+ s.avail_out = git_deflate_bound(&s, s.avail_in);
s.next_out = out = xrealloc(out, s.avail_out);
while (git_deflate(&s, Z_FINISH) == Z_OK)
; /* nothing */
diff --git a/http-push.c b/http-push.c
index 46e68c80e5f4982c5737746e296388735470691d..ecd67cf40a2780db4d73f9a28e2b961e6752cfeb 100644 (file)
--- a/http-push.c
+++ b/http-push.c
/* Set it up */
memset(&stream, 0, sizeof(stream));
git_deflate_init(&stream, zlib_compression_level);
- size = deflateBound(&stream, len + hdrlen);
+ size = git_deflate_bound(&stream, len + hdrlen);
strbuf_init(&request->buffer.buf, size);
request->buffer.posn = 0;
diff --git a/remote-curl.c b/remote-curl.c
index 3c7621aa06ab9462a119ba3002b52e58f6428f0d..13d8ceede345893b76fa2f15597d90304a50cf8e 100644 (file)
--- a/remote-curl.c
+++ b/remote-curl.c
memset(&stream, 0, sizeof(stream));
git_deflate_init_gzip(&stream, Z_BEST_COMPRESSION);
- size = deflateBound(&stream, rpc->len);
+ size = git_deflate_bound(&stream, rpc->len);
gzip_body = xmalloc(size);
stream.next_in = (unsigned char *)rpc->buf;
index ee47a3a4a9b9e01fbd0e30a326b208d7a492ceb1..8f19d2fe388b2a75699d873618da05a15dd4e2a0 100644 (file)
--- a/zlib.c
+++ b/zlib.c
return status;
}
+#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200
+#define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
+#endif
+
+unsigned long git_deflate_bound(z_streamp strm, unsigned long size)
+{
+ return deflateBound(strm, size);
+}
+
void git_deflate_init(z_streamp strm, int level)
{
int status = deflateInit(strm, level);