aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-01-28 09:41:30 +0100
committerJunio C Hamano <gitster@pobox.com>2025-01-28 13:03:22 -0800
commit41f1a8435a900b660b7a6bc9da8dce2665e4b70a (patch)
tree8db1a650c6fdf589021007fedb365de8e0100791
parentcompat: introduce new "zlib.h" header (diff)
downloadgit-41f1a8435a900b660b7a6bc9da8dce2665e4b70a.tar.gz
git-41f1a8435a900b660b7a6bc9da8dce2665e4b70a.zip
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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--archive.c1
-rw-r--r--config.c1
-rw-r--r--csum-file.c3
-rw-r--r--environment.c1
-rw-r--r--git-compat-util.h2
-rw-r--r--git-zlib.h2
-rw-r--r--reftable/block.c1
-rw-r--r--reftable/system.h1
8 files changed, 8 insertions, 4 deletions
diff --git a/archive.c b/archive.c
index b9c200cba6..8be4e7ac8d 100644
--- a/archive.c
+++ b/archive.c
@@ -7,6 +7,7 @@
#include "convert.h"
#include "environment.h"
#include "gettext.h"
+#include "git-zlib.h"
#include "hex.h"
#include "object-name.h"
#include "path.h"
diff --git a/config.c b/config.c
index 50f2d17b39..36f76fafe5 100644
--- a/config.c
+++ b/config.c
@@ -19,6 +19,7 @@
#include "convert.h"
#include "environment.h"
#include "gettext.h"
+#include "git-zlib.h"
#include "ident.h"
#include "repository.h"
#include "lockfile.h"
diff --git a/csum-file.c b/csum-file.c
index 5716016e12..78e04356d3 100644
--- a/csum-file.c
+++ b/csum-file.c
@@ -11,9 +11,10 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
-#include "progress.h"
#include "csum-file.h"
+#include "git-zlib.h"
#include "hash.h"
+#include "progress.h"
static void verify_buffer_or_die(struct hashfile *f,
const void *buf,
diff --git a/environment.c b/environment.c
index 8389a27270..e5b361bb5d 100644
--- a/environment.c
+++ b/environment.c
@@ -16,6 +16,7 @@
#include "convert.h"
#include "environment.h"
#include "gettext.h"
+#include "git-zlib.h"
#include "repository.h"
#include "config.h"
#include "refs.h"
diff --git a/git-compat-util.h b/git-compat-util.h
index 1ca2671322..fb25fbf503 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1537,8 +1537,6 @@ int cmd_main(int, const char **);
int common_exit(const char *file, int line, int code);
#define exit(code) exit(common_exit(__FILE__, __LINE__, (code)))
-#include "compat/zlib-compat.h"
-
/*
* This include must come after system headers, since it introduces macros that
* replace system names.
diff --git a/git-zlib.h b/git-zlib.h
index d8a670aff9..1e8d9aabcb 100644
--- a/git-zlib.h
+++ b/git-zlib.h
@@ -1,6 +1,8 @@
#ifndef GIT_ZLIB_H
#define GIT_ZLIB_H
+#include "compat/zlib-compat.h"
+
typedef struct git_zstream {
z_stream z;
unsigned long avail_in;
diff --git a/reftable/block.c b/reftable/block.c
index bc9b079634..38e3081c61 100644
--- a/reftable/block.c
+++ b/reftable/block.c
@@ -13,7 +13,6 @@ https://developers.google.com/open-source/licenses/bsd
#include "record.h"
#include "reftable-error.h"
#include "system.h"
-#include "compat/zlib-compat.h"
int header_size(int version)
{
diff --git a/reftable/system.h b/reftable/system.h
index 5274eca1d0..f194a38686 100644
--- a/reftable/system.h
+++ b/reftable/system.h
@@ -14,6 +14,7 @@ https://developers.google.com/open-source/licenses/bsd
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
+#include "compat/zlib-compat.h"
/*
* An implementation-specific temporary file. By making this specific to the