Skip to content

Commit

Permalink
Don't make gzip/bzip2 stream buffers be separate allocations.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Nov 15, 2010
1 parent 27dc03f commit 74e5083
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions fileio.c
Expand Up @@ -52,7 +52,7 @@ typedef struct GZIPinfo
{
MojoInput *origio;
uint64 uncompressed_position;
uint8 *buffer;
uint8 buffer[GZIP_READBUFSIZE];
z_stream stream;
} GZIPinfo;

Expand Down Expand Up @@ -199,7 +199,6 @@ static void MojoInput_gzip_close(MojoInput *io)
if (info->origio != NULL)
info->origio->close(info->origio);
inflateEnd(&info->stream);
free(info->buffer);
free(info);
free(io);
} // MojoInput_gzip_close
Expand All @@ -217,7 +216,6 @@ static MojoInput *make_gzip_input(MojoInput *origio)
} // if

info->origio = origio;
info->buffer = (uint8 *) xmalloc(GZIP_READBUFSIZE);

io = (MojoInput *) xmalloc(sizeof (MojoInput));
io->ready = MojoInput_gzip_ready;
Expand Down Expand Up @@ -246,7 +244,7 @@ typedef struct BZIP2info
{
MojoInput *origio;
uint64 uncompressed_position;
uint8 *buffer;
uint8 buffer[BZIP2_READBUFSIZE];
bz_stream stream;
} BZIP2info;

Expand Down Expand Up @@ -406,7 +404,6 @@ static void MojoInput_bzip2_close(MojoInput *io)
if (info->origio != NULL)
info->origio->close(info->origio);
BZ2_bzDecompressEnd(&info->stream);
free(info->buffer);
free(info);
free(io);
} // MojoInput_bzip2_close
Expand All @@ -424,7 +421,6 @@ static MojoInput *make_bzip2_input(MojoInput *origio)
} // if

info->origio = origio;
info->buffer = (uint8 *) xmalloc(BZIP2_READBUFSIZE);

io = (MojoInput *) xmalloc(sizeof (MojoInput));
io->ready = MojoInput_bzip2_ready;
Expand Down

0 comments on commit 74e5083

Please sign in to comment.