{"thread":{"id":"11571","subject":"[PATCH 5/5] Use new decompress helpers in sha1_file.c","startedAt":"2008-01-10T21:09:20Z","lastAt":"2008-01-10T21:09:20Z","messageCount":1,"participants":["Marco Costalba"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"64950","messageId":"e5bfff550801101309p62f235beh776f0ffe521d2e91@mail.gmail.com","threadId":"11571","inReplyTo":null,"subject":"[PATCH 5/5] Use new decompress helpers in sha1_file.c","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2008-01-10T21:09:20Z","receivedAt":"2008-01-10T21:09:20Z","isPatch":true,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"Signed-off-by: Marco Costalba <mcostalba@gmail.com>\n---\n sha1_file.c |   15 +++++----------\n 1 files changed, 5 insertions(+), 10 deletions(-)\n\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 6583797..2a76043 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -7,6 +7,7 @@\n  * creation etc.\n  */\n #include \"cache.h\"\n+#include \"compress.h\"\n #include \"delta.h\"\n #include \"pack.h\"\n #include \"blob.h\"\n@@ -2086,25 +2087,19 @@ int write_sha1_file(void *buf, unsigned long\nlen, const char *type, unsigned cha\n \t}\n\n \t/* Set it up */\n-\tmemset(&stream, 0, sizeof(stream));\n-\tdeflateInit(&stream, zlib_compression_level);\n-\tsize = 8 + deflateBound(&stream, len+hdrlen);\n+\tsize = 8 + z_deflate_init(&stream, zlib_compression_level, len+hdrlen);\n \tcompressed = xmalloc(size);\n\n \t/* Compress it */\n-\tstream.next_out = compressed;\n-\tstream.avail_out = size;\n+\tz_deflate_start(&stream, (unsigned char *)hdr, hdrlen, compressed, size);\n\n \t/* First header.. */\n-\tstream.next_in = (unsigned char *)hdr;\n-\tstream.avail_in = hdrlen;\n-\twhile (deflate(&stream, 0) == Z_OK)\n-\t\t/* nothing */;\n+\tz_deflate_next(&stream, Z_NO_FLUSH);\n\n \t/* Then the data itself.. */\n \tstream.next_in = buf;\n \tstream.avail_in = len;\n-\tret = deflate(&stream, Z_FINISH);\n+\tret = z_deflate_next(&stream, Z_FINISH);\n \tif (ret != Z_STREAM_END)\n \t\tdie(\"unable to deflate new object %s (%d)\", sha1_to_hex(sha1), ret);\n\n-- \n1.5.4.rc2.89.g1b3f\n"}]}