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>
This commit is contained in:

committed by
Junio C Hamano

parent
41f1a8435a
commit
a2dcb69998
@ -3,4 +3,8 @@
|
|||||||
|
|
||||||
#include <zlib.h>
|
#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 */
|
#endif /* COMPAT_ZLIB_H */
|
||||||
|
@ -147,10 +147,6 @@ int git_inflate(git_zstream *strm, int flush)
|
|||||||
return status;
|
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(git_zstream *strm, unsigned long size)
|
unsigned long git_deflate_bound(git_zstream *strm, unsigned long size)
|
||||||
{
|
{
|
||||||
return deflateBound(&strm->z, size);
|
return deflateBound(&strm->z, size);
|
||||||
|
Reference in New Issue
Block a user