git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* compiling git with ZLIB < 1.2
       [not found] <S262157AbVDVVWs/20050422212248Z+375@vger.kernel.org>
@ 2005-04-22 22:12 ` Andreas Gal
  0 siblings, 0 replies; only message in thread
From: Andreas Gal @ 2005-04-22 22:12 UTC (permalink / raw)
  To: git


deflateBound() was added in ZLIB 1.2, but there is unfortunately no easy 
way to check against the ZLIB version. I would suggest to use the fix 
below until everyone has a recent ZLIB installed (neither my RHEL3 nor my 
Darwin box does by default).

Andreas

--- a/sha1_file.c
+++ b/sha1_file.c
@@ -240,7 +240,11 @@ int write_sha1_file(char *buf, unsigned 
 	/* Set it up */
 	memset(&stream, 0, sizeof(stream));
 	deflateInit(&stream, Z_BEST_COMPRESSION);
+#ifdef ONCE_EVERYONE_UPDATED_TO_ZLIB_12
 	size = deflateBound(&stream, len);
+#else	
+	size = len + ((len + 7) >> 3) + ((len + 63) >> 6) + 11;
+#endif	
 	compressed = malloc(size);
 
 	/* Compress it */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-22 22:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <S262157AbVDVVWs/20050422212248Z+375@vger.kernel.org>
2005-04-22 22:12 ` compiling git with ZLIB < 1.2 Andreas Gal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).