MCPcopy Create free account
hub / github.com/git/git / git_deflate

Function git_deflate

git-zlib.c:253–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253int git_deflate(git_zstream *strm, int flush)
254{
255 int status;
256
257 for (;;) {
258 zlib_pre_call(strm);
259
260 /* Never say Z_FINISH unless we are feeding everything */
261 status = deflate(&strm->z,
262 (strm->z.avail_in != strm->avail_in)
263 ? 0 : flush);
264 if (status == Z_MEM_ERROR)
265 die("deflate: out of memory");
266 zlib_post_call(strm, status);
267
268 /*
269 * Let zlib work another round, while we can still
270 * make progress.
271 */
272 if ((strm->avail_out && !strm->z.avail_out) &&
273 (status == Z_OK || status == Z_BUF_ERROR))
274 continue;
275 break;
276 }
277
278 switch (status) {
279 /* Z_BUF_ERROR: normal, needs more space in the output buffer */
280 case Z_BUF_ERROR:
281 case Z_OK:
282 case Z_STREAM_END:
283 return status;
284 default:
285 break;
286 }
287 error("deflate: %s (%s)", zerr_to_string(status),
288 strm->z.msg ? strm->z.msg : "no message");
289 return status;
290}

Callers 15

zlib_deflate_rawFunction · 0.85
write_zip_entryFunction · 0.85
tgz_deflateFunction · 0.85
stream_blob_to_packFunction · 0.85
start_putFunction · 0.85
post_rpcFunction · 0.85
deflate_itFunction · 0.85
do_compressFunction · 0.85
write_compressedFunction · 0.85
store_objectFunction · 0.85

Calls 5

zlib_pre_callFunction · 0.85
zlib_post_callFunction · 0.85
errorFunction · 0.85
zerr_to_stringFunction · 0.85
dieFunction · 0.70

Tested by 1

do_compressFunction · 0.68