git-zlib: move declarations for git-zlib functions from cache.h
Move functions from cache.h for zlib.c into a new header file. Since adding a "zlib.h" would cause issues with the real zlib, rename zlib.c to git-zlib.c while we are at it. Signed-off-by: Elijah Newren <newren@gmail.com> Acked-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Apr 11, 2023 at 00:41 UTC
d88dbaa71864c42df1394be25234d7c187a12f48
9 files changed
+39
-26
Makefile
+1
-1
@@ -1036,6 +1036,7 @@ LIB_OBJS += fsmonitor.o
1036
LIB_OBJS += fsmonitor-ipc.o
1037
LIB_OBJS += fsmonitor-settings.o
1038
LIB_OBJS += gettext.o
1039
+LIB_OBJS += git-zlib.o
1040
LIB_OBJS += gpg-interface.o
1041
LIB_OBJS += graph.o
1042
LIB_OBJS += grep.o
@@ -1196,7 +1197,6 @@ LIB_OBJS += write-or-die.o
1197
LIB_OBJS += ws.o
1198
LIB_OBJS += wt-status.o
1199
LIB_OBJS += xdiff-interface.o
1199
-LIB_OBJS += zlib.o
1200
1201
BUILTIN_OBJS += builtin/add.o
1202
BUILTIN_OBJS += builtin/am.o
archive-tar.c
+1
@@ -5,6 +5,7 @@
5
#include "alloc.h"
6
#include "config.h"
7
#include "gettext.h"
8
+#include "git-zlib.h"
9
#include "hex.h"
10
#include "tar.h"
11
#include "archive.h"
archive-zip.c
+1
@@ -5,6 +5,7 @@
5
#include "config.h"
6
#include "archive.h"
7
#include "gettext.h"
8
+#include "git-zlib.h"
9
#include "hex.h"
10
#include "streaming.h"
11
#include "utf8.h"
builtin/unpack-objects.c
+1
@@ -4,6 +4,7 @@
4
#include "config.h"
5
#include "environment.h"
6
#include "gettext.h"
7
+#include "git-zlib.h"
8
#include "hex.h"
9
#include "object-store.h"
10
#include "object.h"
cache.h
+1
-24
@@ -3,6 +3,7 @@
3
4
#include "git-compat-util.h"
5
#include "strbuf.h"
6
+#include "git-zlib.h"
7
#include "hashmap.h"
8
#include "list.h"
9
#include "gettext.h"
@@ -14,30 +15,6 @@
15
#include "repository.h"
16
#include "statinfo.h"
17
17
-typedef struct git_zstream {
18
- z_stream z;
19
- unsigned long avail_in;
20
- unsigned long avail_out;
21
- unsigned long total_in;
22
- unsigned long total_out;
23
- unsigned char *next_in;
24
- unsigned char *next_out;
25
-} git_zstream;
26
-
27
-void git_inflate_init(git_zstream *);
28
-void git_inflate_init_gzip_only(git_zstream *);
29
-void git_inflate_end(git_zstream *);
30
-int git_inflate(git_zstream *, int flush);
31
-
32
-void git_deflate_init(git_zstream *, int level);
33
-void git_deflate_init_gzip(git_zstream *, int level);
34
-void git_deflate_init_raw(git_zstream *, int level);
35
-void git_deflate_end(git_zstream *);
36
-int git_deflate_abort(git_zstream *);
37
-int git_deflate_end_gently(git_zstream *);
38
-int git_deflate(git_zstream *, int flush);
39
-unsigned long git_deflate_bound(git_zstream *, unsigned long);
40
-
18
#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
19
#define DTYPE(de) ((de)->d_type)
20
#else
git-zlib.c
renamed
+2
-1
@@ -2,7 +2,8 @@
2
* zlib wrappers to make sure we don't silently miss errors
3
* at init time.
4
*/
5
-#include "cache.h"
5
+#include "git-compat-util.h"
6
+#include "git-zlib.h"
7
8
static const char *zerr_to_string(int status)
9
{
git-zlib.h
new
+28
@@ -0,0 +1,28 @@
1
+#ifndef GIT_ZLIB_H
2
+#define GIT_ZLIB_H
3
+
4
+typedef struct git_zstream {
5
+ z_stream z;
6
+ unsigned long avail_in;
7
+ unsigned long avail_out;
8
+ unsigned long total_in;
9
+ unsigned long total_out;
10
+ unsigned char *next_in;
11
+ unsigned char *next_out;
12
+} git_zstream;
13
+
14
+void git_inflate_init(git_zstream *);
15
+void git_inflate_init_gzip_only(git_zstream *);
16
+void git_inflate_end(git_zstream *);
17
+int git_inflate(git_zstream *, int flush);
18
+
19
+void git_deflate_init(git_zstream *, int level);
20
+void git_deflate_init_gzip(git_zstream *, int level);
21
+void git_deflate_init_raw(git_zstream *, int level);
22
+void git_deflate_end(git_zstream *);
23
+int git_deflate_abort(git_zstream *);
24
+int git_deflate_end_gently(git_zstream *);
25
+int git_deflate(git_zstream *, int flush);
26
+unsigned long git_deflate_bound(git_zstream *, unsigned long);
27
+
28
+#endif /* GIT_ZLIB_H */
http-backend.c
+1
@@ -2,6 +2,7 @@
2
#include "alloc.h"
3
#include "config.h"
4
#include "environment.h"
5
+#include "git-zlib.h"
6
#include "hex.h"
7
#include "repository.h"
8
#include "refs.h"
http.h
+3
@@ -1,7 +1,10 @@
1
#ifndef HTTP_H
2
#define HTTP_H
3
4
+struct packed_git;
5
+
6
#include "cache.h"
7
+#include "git-zlib.h"
8
9
#include <curl/curl.h>
10
#include <curl/easy.h>