diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-28 20:15:46 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-28 20:15:46 +0000 |
commit | c2ce0b613efa992b5dd68d39395ac1ed9da0ea3f (patch) | |
tree | f43b3bad06497fcda84ed02b733b746780b3a58f | |
parent | 5850e7bb136e7cfc01732bf69f39e832883d187d (diff) | |
download | chromium_src-c2ce0b613efa992b5dd68d39395ac1ed9da0ea3f.zip chromium_src-c2ce0b613efa992b5dd68d39395ac1ed9da0ea3f.tar.gz chromium_src-c2ce0b613efa992b5dd68d39395ac1ed9da0ea3f.tar.bz2 |
Simplify goobspatch: the in and out members of xzfile don't need to be
malloced separately.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2810030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51035 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/installer/mac/third_party/bsdiff/goobspatch.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/chrome/installer/mac/third_party/bsdiff/goobspatch.c b/chrome/installer/mac/third_party/bsdiff/goobspatch.c index 5287825..c06aaaa 100644 --- a/chrome/installer/mac/third_party/bsdiff/goobspatch.c +++ b/chrome/installer/mac/third_party/bsdiff/goobspatch.c @@ -69,13 +69,13 @@ static void sha1tostr(const u_char *sha1, char *sha1str) * read-only and only supports sequential access. */ typedef struct { + /* in and out are the underlying buffers to be used with lzma_stream. */ + u_char in[BUFSIZ]; + u_char out[BUFSIZ]; + lzma_stream ls; FILE *f; - /* in and out are the underlying buffers to be used with lzma_stream. */ - u_char *in; - u_char *out; - /* read_out points to the first byte in out not yet consumed by an * xzread call. read_out_len tracks the amount of data available in * out beginning at read_out. */ @@ -104,16 +104,6 @@ static xzfile *xzdopen(FILE *f, lzma_ret *err) xzf->ls = ls; xzf->f = f; - xzf->in = NULL; - xzf->out = NULL; - if (!(xzf->in = malloc(BUFSIZ)) || !(xzf->out = malloc(BUFSIZ))) { - if (err) *err = LZMA_MEM_ERROR; - free(xzf->out); - free(xzf->in); - free(xzf); - return NULL; - } - xzf->read_out = xzf->out; xzf->read_out_len = 0; @@ -140,8 +130,6 @@ static xzfile *xzdopen(FILE *f, lzma_ret *err) LZMA_TELL_UNSUPPORTED_CHECK); if (xzf->err != LZMA_OK) { if (err) *err = xzf->err; - free(xzf->out); - free(xzf->in); free(xzf); return NULL; } @@ -159,8 +147,6 @@ static lzma_ret xzclose(xzfile *xzf) lzma_end(&xzf->ls); if (fclose(xzf->f) != 0) lzma_err = LZMA_STREAM_END; - free(xzf->out); - free(xzf->in); free(xzf); return lzma_err; |