| 385 | } |
| 386 | |
| 387 | static unsigned long do_compress(void **pptr, unsigned long size) |
| 388 | { |
| 389 | git_zstream stream; |
| 390 | void *in, *out; |
| 391 | unsigned long maxsize; |
| 392 | struct repo_config_values *cfg = repo_config_values(the_repository); |
| 393 | |
| 394 | git_deflate_init(&stream, cfg->pack_compression_level); |
| 395 | maxsize = git_deflate_bound(&stream, size); |
| 396 | |
| 397 | in = *pptr; |
| 398 | out = xmalloc(maxsize); |
| 399 | *pptr = out; |
| 400 | |
| 401 | stream.next_in = in; |
| 402 | stream.avail_in = size; |
| 403 | stream.next_out = out; |
| 404 | stream.avail_out = maxsize; |
| 405 | while (git_deflate(&stream, Z_FINISH) == Z_OK) |
| 406 | ; /* nothing */ |
| 407 | git_deflate_end(&stream); |
| 408 | |
| 409 | free(in); |
| 410 | return stream.total_out; |
| 411 | } |
| 412 | |
| 413 | static unsigned long write_large_blob_data(struct odb_read_stream *st, struct hashfile *f, |
| 414 | const struct object_id *oid) |
no test coverage detected