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

Function deflate_it

diff.c:3608–3630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3606}
3607
3608static unsigned char *deflate_it(char *data,
3609 unsigned long size,
3610 unsigned long *result_size)
3611{
3612 int bound;
3613 unsigned char *deflated;
3614 git_zstream stream;
3615 struct repo_config_values *cfg = repo_config_values(the_repository);
3616
3617 git_deflate_init(&stream, cfg->zlib_compression_level);
3618 bound = git_deflate_bound(&stream, size);
3619 deflated = xmalloc(bound);
3620 stream.next_out = deflated;
3621 stream.avail_out = bound;
3622
3623 stream.next_in = (unsigned char *)data;
3624 stream.avail_in = size;
3625 while (git_deflate(&stream, Z_FINISH) == Z_OK)
3626 ; /* nothing */
3627 git_deflate_end(&stream);
3628 *result_size = stream.total_out;
3629 return deflated;
3630}
3631
3632static void emit_binary_diff_body(struct diff_options *o,
3633 mmfile_t *one, mmfile_t *two)

Callers 1

emit_binary_diff_bodyFunction · 0.85

Calls 6

git_deflate_initFunction · 0.85
git_deflate_boundFunction · 0.85
git_deflateFunction · 0.85
git_deflate_endFunction · 0.85
repo_config_valuesClass · 0.70
xmallocFunction · 0.70

Tested by

no test coverage detected