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

Function inflate_it

apply.c:1990–2011  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1988}
1989
1990static char *inflate_it(const void *data, unsigned long size,
1991 unsigned long inflated_size)
1992{
1993 git_zstream stream;
1994 void *out;
1995 int st;
1996
1997 memset(&stream, 0, sizeof(stream));
1998
1999 stream.next_in = (unsigned char *)data;
2000 stream.avail_in = size;
2001 stream.next_out = out = xmalloc(inflated_size);
2002 stream.avail_out = inflated_size;
2003 git_inflate_init(&stream);
2004 st = git_inflate(&stream, Z_FINISH);
2005 git_inflate_end(&stream);
2006 if ((st != Z_STREAM_END) || stream.total_out != inflated_size) {
2007 free(out);
2008 return NULL;
2009 }
2010 return out;
2011}
2012
2013/*
2014 * Read a binary hunk and return a new fragment; fragment->patch

Callers 1

parse_binary_hunkFunction · 0.85

Calls 4

git_inflate_initFunction · 0.85
git_inflateFunction · 0.85
git_inflate_endFunction · 0.85
xmallocFunction · 0.70

Tested by

no test coverage detected