Increase maxram when we abandon use of temporary input/output buffers

This commit is contained in:
Con Kolivas 2015-03-03 14:15:09 +11:00
parent b48c3b2ee4
commit c14f9ccab3
3 changed files with 15 additions and 6 deletions

12
lrzip.c
View file

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2006-2013 Con Kolivas Copyright (C) 2006-2015 Con Kolivas
Copyright (C) 2011 Peter Hyman Copyright (C) 2011 Peter Hyman
Copyright (C) 1998-2003 Andrew Tridgell Copyright (C) 1998-2003 Andrew Tridgell
@ -504,10 +504,15 @@ static bool open_tmpoutbuf(rzip_control *control)
return true; return true;
} }
/* We've decided to use a temporary output file instead of trying to store
* all the output buffer in ram so we can free up the ram and increase the
* maximum sizes of ram we can allocate */
void close_tmpoutbuf(rzip_control *control) void close_tmpoutbuf(rzip_control *control)
{ {
control->flags &= ~FLAG_TMP_OUTBUF; control->flags &= ~FLAG_TMP_OUTBUF;
free(control->tmp_outbuf); free(control->tmp_outbuf);
if (!BITS32)
control->usable_ram = control->maxram += control->ramsize / 18;
} }
static bool open_tmpinbuf(rzip_control *control) static bool open_tmpinbuf(rzip_control *control)
@ -534,10 +539,13 @@ bool clear_tmpinfile(rzip_control *control)
return true; return true;
} }
/* As per temporary output file but for input file */
void close_tmpinbuf(rzip_control *control) void close_tmpinbuf(rzip_control *control)
{ {
control->flags &= ~FLAG_TMP_INBUF; control->flags &= ~FLAG_TMP_INBUF;
free(control->tmp_inbuf); free(control->tmp_inbuf);
if (!BITS32)
control->usable_ram = control->maxram += control->ramsize / 18;
} }
static int get_pass(rzip_control *control, char *s) static int get_pass(rzip_control *control, char *s)
@ -1215,7 +1223,7 @@ error:
return false; return false;
} }
bool initialize_control(rzip_control *control) bool initialise_control(rzip_control *control)
{ {
struct timeval tv; struct timeval tv;
char *eptr; /* for environment */ char *eptr; /* for environment */

View file

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2006-2011 Con Kolivas Copyright (C) 2006-2015 Con Kolivas
Copyright (C) 2011 Peter Hyman Copyright (C) 2011 Peter Hyman
Copyright (C) 1998-2003 Andrew Tridgell Copyright (C) 1998-2003 Andrew Tridgell
@ -41,7 +41,8 @@ void close_tmpoutbuf(rzip_control *control);
void clear_tmpinbuf(rzip_control *control); void clear_tmpinbuf(rzip_control *control);
bool clear_tmpinfile(rzip_control *control); bool clear_tmpinfile(rzip_control *control);
void close_tmpinbuf(rzip_control *control); void close_tmpinbuf(rzip_control *control);
bool initialize_control(rzip_control *control); bool initialise_control(rzip_control *control);
#define initialize_control(_control) initialise_control(_control)
extern void zpaq_compress(uchar *c_buf, i64 *c_len, uchar *s_buf, i64 s_len, int level, extern void zpaq_compress(uchar *c_buf, i64 *c_len, uchar *s_buf, i64 s_len, int level,
FILE *msgout, bool progress, long thread); FILE *msgout, bool progress, long thread);
extern void zpaq_decompress(uchar *s_buf, i64 *d_len, uchar *c_buf, i64 c_len, extern void zpaq_decompress(uchar *s_buf, i64 *d_len, uchar *c_buf, i64 c_len,

4
main.c
View file

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2006-2013 Con Kolivas Copyright (C) 2006-2015 Con Kolivas
Copyright (C) 2011 Peter Hyman Copyright (C) 2011 Peter Hyman
Copyright (C) 1998-2003 Andrew Tridgell Copyright (C) 1998-2003 Andrew Tridgell
@ -199,7 +199,7 @@ int main(int argc, char *argv[])
control = &base_control; control = &base_control;
initialize_control(control); initialise_control(control);
if (strstr(argv[0], "lrunzip")) if (strstr(argv[0], "lrunzip"))
control->flags |= FLAG_DECOMPRESS; control->flags |= FLAG_DECOMPRESS;