git/list[1] front-page[2] threads[3] people[4] search[5] about
 

compiling git with ZLIB < 1.2

From
AGAndreas Gal <gal@uci.edu>
Date
Apr 22, 2005, 22:12 UTC
Message-ID
<Pine.LNX.4.58.0504221508530.22285@sam.ics.uci.edu>
In-Reply-To
<S262157AbVDVVWs/20050422212248Z+375@vger.kernel.org>

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 */
Message 1 of 1 in “compiling git with ZLIB < 1.2”
  1. Andreas GalApr 22, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.