Skip to content

Commit d88dbaa

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Acked-by: Calvin Wan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e93fc5d commit d88dbaa

9 files changed

+39
-26
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ LIB_OBJS += fsmonitor.o
10361036
LIB_OBJS += fsmonitor-ipc.o
10371037
LIB_OBJS += fsmonitor-settings.o
10381038
LIB_OBJS += gettext.o
1039+
LIB_OBJS += git-zlib.o
10391040
LIB_OBJS += gpg-interface.o
10401041
LIB_OBJS += graph.o
10411042
LIB_OBJS += grep.o
@@ -1196,7 +1197,6 @@ LIB_OBJS += write-or-die.o
11961197
LIB_OBJS += ws.o
11971198
LIB_OBJS += wt-status.o
11981199
LIB_OBJS += xdiff-interface.o
1199-
LIB_OBJS += zlib.o
12001200

12011201
BUILTIN_OBJS += builtin/add.o
12021202
BUILTIN_OBJS += builtin/am.o

archive-tar.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "alloc.h"
66
#include "config.h"
77
#include "gettext.h"
8+
#include "git-zlib.h"
89
#include "hex.h"
910
#include "tar.h"
1011
#include "archive.h"

archive-zip.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "config.h"
66
#include "archive.h"
77
#include "gettext.h"
8+
#include "git-zlib.h"
89
#include "hex.h"
910
#include "streaming.h"
1011
#include "utf8.h"

builtin/unpack-objects.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "config.h"
55
#include "environment.h"
66
#include "gettext.h"
7+
#include "git-zlib.h"
78
#include "hex.h"
89
#include "object-store.h"
910
#include "object.h"

cache.h

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "git-compat-util.h"
55
#include "strbuf.h"
6+
#include "git-zlib.h"
67
#include "hashmap.h"
78
#include "list.h"
89
#include "gettext.h"
@@ -14,30 +15,6 @@
1415
#include "repository.h"
1516
#include "statinfo.h"
1617

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-
4118
#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
4219
#define DTYPE(de) ((de)->d_type)
4320
#else

zlib.c renamed to git-zlib.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* zlib wrappers to make sure we don't silently miss errors
33
* at init time.
44
*/
5-
#include "cache.h"
5+
#include "git-compat-util.h"
6+
#include "git-zlib.h"
67

78
static const char *zerr_to_string(int status)
89
{

git-zlib.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "alloc.h"
33
#include "config.h"
44
#include "environment.h"
5+
#include "git-zlib.h"
56
#include "hex.h"
67
#include "repository.h"
78
#include "refs.h"

http.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#ifndef HTTP_H
22
#define HTTP_H
33

4+
struct packed_git;
5+
46
#include "cache.h"
7+
#include "git-zlib.h"
58

69
#include <curl/curl.h>
710
#include <curl/easy.h>

0 commit comments

Comments
 (0)