mirror of
https://github.com/git/git.git
synced 2025-12-05 18:47:16 -06:00
Throughout the Git codebase we're using the typedeffed version of `z_stream`, which maps to `struct z_stream_s`. By using a typedef instead of the struct it becomes somewhat harder to predeclare the symbol so that headers depending on the struct can do so without having to pull in "zlib-compat.h". We don't yet have users that would really care about this: the only users that declare `z_stream` as a pointer are in "reftable/block.h", which is a header that is internal to the reftable library. But in the next step we're going to expose the `struct reftable_block` publicly, and that struct does contain a pointer to `z_stream`. And as the public header shouldn't depend on "reftable/system.h", which is an internal implementation detail, we won't have the typedef for `z_stream` readily available. Prepare for this change by using `struct z_stream_s` throughout our code base. In case zlib-ng is used we use a define to map from `z_stream_s` to `zng_stream_s`. Drop the pre-declaration of `struct z_stream` while at it. This struct does not exist in the first place, and the declaration wasn't needed because "reftable/block.h" already includes "reftable/basics.h" which transitively includes "reftable/system.h" and thus "git-zlib.h". Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
31 lines
864 B
C
31 lines
864 B
C
#ifndef GIT_ZLIB_H
|
|
#define GIT_ZLIB_H
|
|
|
|
#include "compat/zlib-compat.h"
|
|
|
|
typedef struct git_zstream {
|
|
struct z_stream_s z;
|
|
unsigned long avail_in;
|
|
unsigned long avail_out;
|
|
unsigned long total_in;
|
|
unsigned long total_out;
|
|
unsigned char *next_in;
|
|
unsigned char *next_out;
|
|
} git_zstream;
|
|
|
|
void git_inflate_init(git_zstream *);
|
|
void git_inflate_init_gzip_only(git_zstream *);
|
|
void git_inflate_end(git_zstream *);
|
|
int git_inflate(git_zstream *, int flush);
|
|
|
|
void git_deflate_init(git_zstream *, int level);
|
|
void git_deflate_init_gzip(git_zstream *, int level);
|
|
void git_deflate_init_raw(git_zstream *, int level);
|
|
void git_deflate_end(git_zstream *);
|
|
int git_deflate_abort(git_zstream *);
|
|
int git_deflate_end_gently(git_zstream *);
|
|
int git_deflate(git_zstream *, int flush);
|
|
unsigned long git_deflate_bound(git_zstream *, unsigned long);
|
|
|
|
#endif /* GIT_ZLIB_H */
|