Skip to content

Commit 41f1a84

Browse files
pks-tgitster
authored andcommitted
git-compat-util: move include of "compat/zlib.h" into "git-zlib.h"
We include "compat/zlib.h" in "git-compat-util.h", which is unnecessarily broad given that we only have a small handful of files that use the zlib library. Move the header into "git-zlib.h" instead and adapt users of zlib to include that header. One exception is the reftable library, as we don't want to use the Git-specific wrapper of zlib there, so we include "compat/zlib.h" instead. Furthermore, we move the include into "reftable/system.h" so that users of the library other than Git can wire up zlib themselves. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 629188e commit 41f1a84

File tree

8 files changed

+8
-4
lines changed

8 files changed

+8
-4
lines changed

archive.c

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "convert.h"
88
#include "environment.h"
99
#include "gettext.h"
10+
#include "git-zlib.h"
1011
#include "hex.h"
1112
#include "object-name.h"
1213
#include "path.h"

config.c

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "convert.h"
2020
#include "environment.h"
2121
#include "gettext.h"
22+
#include "git-zlib.h"
2223
#include "ident.h"
2324
#include "repository.h"
2425
#include "lockfile.h"

csum-file.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
#define USE_THE_REPOSITORY_VARIABLE
1212

1313
#include "git-compat-util.h"
14-
#include "progress.h"
1514
#include "csum-file.h"
15+
#include "git-zlib.h"
1616
#include "hash.h"
17+
#include "progress.h"
1718

1819
static void verify_buffer_or_die(struct hashfile *f,
1920
const void *buf,

environment.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "convert.h"
1717
#include "environment.h"
1818
#include "gettext.h"
19+
#include "git-zlib.h"
1920
#include "repository.h"
2021
#include "config.h"
2122
#include "refs.h"

git-compat-util.h

-2
Original file line numberDiff line numberDiff line change
@@ -1537,8 +1537,6 @@ int cmd_main(int, const char **);
15371537
int common_exit(const char *file, int line, int code);
15381538
#define exit(code) exit(common_exit(__FILE__, __LINE__, (code)))
15391539

1540-
#include "compat/zlib-compat.h"
1541-
15421540
/*
15431541
* This include must come after system headers, since it introduces macros that
15441542
* replace system names.

git-zlib.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef GIT_ZLIB_H
22
#define GIT_ZLIB_H
33

4+
#include "compat/zlib-compat.h"
5+
46
typedef struct git_zstream {
57
z_stream z;
68
unsigned long avail_in;

reftable/block.c

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ license that can be found in the LICENSE file or at
1313
#include "record.h"
1414
#include "reftable-error.h"
1515
#include "system.h"
16-
#include "compat/zlib-compat.h"
1716

1817
int header_size(int version)
1918
{

reftable/system.h

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ license that can be found in the LICENSE file or at
1414
#define DISABLE_SIGN_COMPARE_WARNINGS
1515

1616
#include "git-compat-util.h"
17+
#include "compat/zlib-compat.h"
1718

1819
/*
1920
* An implementation-specific temporary file. By making this specific to the

0 commit comments

Comments
 (0)