aboutsummaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-01-28 09:41:31 +0100
committerJunio C Hamano <gitster@pobox.com>2025-01-28 13:03:22 -0800
commita2dcb6999837c762b85735174eb16f941830a2e7 (patch)
treef7546772f1addffbb4810e6fb0a2d3b832d41155 /compat
parent41f1a8435a900b660b7a6bc9da8dce2665e4b70a (diff)
downloadgit-a2dcb6999837c762b85735174eb16f941830a2e7.tar.xz
compat/zlib: provide `deflateBound()` shim centrally
The `deflateBound()` function has only been introduced with zlib 1.2.0. When linking against a zlib version older than that we thus provide our own compatibility shim. Move this shim into "compat/zlib.h" so that we can adapt it based on whether or not we use zlib-ng in a subsequent commit. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/zlib-compat.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/compat/zlib-compat.h b/compat/zlib-compat.h
index bc20b884ef..96a08811a9 100644
--- a/compat/zlib-compat.h
+++ b/compat/zlib-compat.h
@@ -3,4 +3,8 @@
#include <zlib.h>
+#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200
+# define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
+#endif
+
#endif /* COMPAT_ZLIB_H */