Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5484)

Unified Diff: chrome/installer/mac/third_party/bsdiff/goobspatch.c

Issue 2810030: Simplify goobspatch: the in and out members of xzfile don't need to be malloced separately (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/mac/third_party/bsdiff/goobspatch.c
===================================================================
--- chrome/installer/mac/third_party/bsdiff/goobspatch.c (revision 50877)
+++ chrome/installer/mac/third_party/bsdiff/goobspatch.c (working copy)
@@ -69,13 +69,13 @@
* 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 @@
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 @@
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 @@
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698