Signed-off-by: Marco Costalba <mcostalba@xxxxxxxxx> --- diff.c | 22 +++++----------------- 1 files changed, 5 insertions(+), 17 deletions(-) diff --git a/diff.c b/diff.c index b18c140..ecfa721 100644 --- a/diff.c +++ b/diff.c @@ -2,6 +2,7 @@ * Copyright (C) 2005 Junio C Hamano */ #include "cache.h" +#include "compress.h" #include "quote.h" #include "diff.h" #include "diffcore.h" @@ -1037,23 +1038,10 @@ static unsigned char *deflate_it(char *data, unsigned long size, unsigned long *result_size) { - int bound; - unsigned char *deflated; - z_stream stream; - - memset(&stream, 0, sizeof(stream)); - deflateInit(&stream, zlib_compression_level); - bound = deflateBound(&stream, size); - deflated = xmalloc(bound); - stream.next_out = deflated; - stream.avail_out = bound; - - stream.next_in = (unsigned char *)data; - stream.avail_in = size; - while (deflate(&stream, Z_FINISH) == Z_OK) - ; /* nothing */ - deflateEnd(&stream); - *result_size = stream.total_out; + unsigned char *deflated = NULL; + + *result_size = z_deflate_all(zlib_compression_level, + (unsigned char *)data, size, &deflated); return deflated; } -- 1.5.4.rc2.89.g1b3f - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html