summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archive-zip.c2
-rw-r--r--builtin/index-pack.c1
-rw-r--r--builtin/pack-objects.c2
-rw-r--r--bulk-checkin.c1
-rw-r--r--diff.c1
-rw-r--r--fast-import.c3
-rw-r--r--http-push.c1
-rw-r--r--remote-curl.c1
-rw-r--r--sha1_file.c1
-rw-r--r--zlib.c2
10 files changed, 2 insertions, 13 deletions
diff --git a/archive-zip.c b/archive-zip.c
index 4bde019..1a54e1b 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -120,7 +120,6 @@ static void *zlib_deflate_raw(void *data, unsigned long size,
void *buffer;
int result;
- memset(&stream, 0, sizeof(stream));
git_deflate_init_raw(&stream, compression_level);
maxsize = git_deflate_bound(&stream, size);
buffer = xmalloc(maxsize);
@@ -349,7 +348,6 @@ static int write_zip_entry(struct archiver_args *args,
size_t out_len;
unsigned char compressed[STREAM_BUFFER_SIZE * 2];
- memset(&zstream, 0, sizeof(zstream));
git_deflate_init_raw(&zstream, args->compression_level);
compressed_size = 0;
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 9ca0203..1239a10 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1173,7 +1173,6 @@ static int write_compressed(struct sha1file *f, void *in, unsigned int size)
int status;
unsigned char outbuf[4096];
- memset(&stream, 0, sizeof(stream));
git_deflate_init(&stream, zlib_compression_level);
stream.next_in = in;
stream.avail_in = size;
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index de36c60..1d1ed1b 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -123,7 +123,6 @@ static unsigned long do_compress(void **pptr, unsigned long size)
void *in, *out;
unsigned long maxsize;
- memset(&stream, 0, sizeof(stream));
git_deflate_init(&stream, pack_compression_level);
maxsize = git_deflate_bound(&stream, size);
@@ -151,7 +150,6 @@ static unsigned long write_large_blob_data(struct git_istream *st, struct sha1fi
unsigned char obuf[1024 * 16];
unsigned long olen = 0;
- memset(&stream, 0, sizeof(stream));
git_deflate_init(&stream, pack_compression_level);
for (;;) {
diff --git a/bulk-checkin.c b/bulk-checkin.c
index 98e651c..136b704 100644
--- a/bulk-checkin.c
+++ b/bulk-checkin.c
@@ -104,7 +104,6 @@ static int stream_to_pack(struct bulk_checkin_state *state,
int write_object = (flags & HASH_WRITE_OBJECT);
off_t offset = 0;
- memset(&s, 0, sizeof(s));
git_deflate_init(&s, pack_compression_level);
hdrlen = encode_in_pack_object_header(type, size, obuf);
diff --git a/diff.c b/diff.c
index 3f1f08f..c90cf72 100644
--- a/diff.c
+++ b/diff.c
@@ -2091,7 +2091,6 @@ static unsigned char *deflate_it(char *data,
unsigned char *deflated;
git_zstream stream;
- memset(&stream, 0, sizeof(stream));
git_deflate_init(&stream, zlib_compression_level);
bound = git_deflate_bound(&stream, size);
deflated = xmalloc(bound);
diff --git a/fast-import.c b/fast-import.c
index fb4738d..f757ef6 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1053,7 +1053,6 @@ static int store_object(
} else
delta = NULL;
- memset(&s, 0, sizeof(s));
git_deflate_init(&s, pack_compression_level);
if (delta) {
s.next_in = delta;
@@ -1081,7 +1080,6 @@ static int store_object(
free(delta);
delta = NULL;
- memset(&s, 0, sizeof(s));
git_deflate_init(&s, pack_compression_level);
s.next_in = (void *)dat->buf;
s.avail_in = dat->len;
@@ -1181,7 +1179,6 @@ static void stream_blob(uintmax_t len, unsigned char *sha1out, uintmax_t mark)
crc32_begin(pack_file);
- memset(&s, 0, sizeof(s));
git_deflate_init(&s, pack_compression_level);
hdrlen = encode_in_pack_object_header(OBJ_BLOB, len, out_buf);
diff --git a/http-push.c b/http-push.c
index bc94a3f..8f473b3 100644
--- a/http-push.c
+++ b/http-push.c
@@ -365,7 +365,6 @@ static void start_put(struct transfer_request *request)
hdrlen = sprintf(hdr, "%s %lu", typename(type), len) + 1;
/* Set it up */
- memset(&stream, 0, sizeof(stream));
git_deflate_init(&stream, zlib_compression_level);
size = git_deflate_bound(&stream, len + hdrlen);
strbuf_init(&request->buffer.buf, size);
diff --git a/remote-curl.c b/remote-curl.c
index 52c2d96..13c639c 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -555,7 +555,6 @@ retry:
git_zstream stream;
int ret;
- memset(&stream, 0, sizeof(stream));
git_deflate_init_gzip(&stream, Z_BEST_COMPRESSION);
gzip_size = git_deflate_bound(&stream, rpc->len);
gzip_body = xmalloc(gzip_size);
diff --git a/sha1_file.c b/sha1_file.c
index a38854c..634c4ac 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2916,7 +2916,6 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
}
/* Set it up */
- memset(&stream, 0, sizeof(stream));
git_deflate_init(&stream, zlib_compression_level);
stream.next_out = compressed;
stream.avail_out = sizeof(compressed);
diff --git a/zlib.c b/zlib.c
index 61e6df0..4223f1a 100644
--- a/zlib.c
+++ b/zlib.c
@@ -159,6 +159,7 @@ void git_deflate_init(git_zstream *strm, int level)
{
int status;
+ memset(strm, 0, sizeof(*strm));
zlib_pre_call(strm);
status = deflateInit(&strm->z, level);
zlib_post_call(strm);
@@ -172,6 +173,7 @@ static void do_git_deflate_init(git_zstream *strm, int level, int windowBits)
{
int status;
+ memset(strm, 0, sizeof(*strm));
zlib_pre_call(strm);
status = deflateInit2(&strm->z, level,
Z_DEFLATED, windowBits,