From: "Marco Costalba" <mcostalba@gmail.com>
To: "Git Mailing List" <git@vger.kernel.org>
Subject: [PATCH 2/5] Use new decompress helpers in diff.c
Date: Thu, 10 Jan 2008 22:06:16 +0100 [thread overview]
Message-ID: <e5bfff550801101306i4e62e339tb9e86414c3e7894e@mail.gmail.com> (raw)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
---
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
reply other threads:[~2008-01-10 21:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e5bfff550801101306i4e62e339tb9e86414c3e7894e@mail.gmail.com \
--to=mcostalba@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).