[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3 4/8] gzip: move window pointer into gunzip state
Move the window pointer, outcnt/wp, into struct gunzip_data. It was erroneously labeled as outcnt and then define aliased to wp, this eliminates the aliasing and only refers to as wp, the window pointer. Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx> --- xen/common/gzip/gunzip.c | 11 +++++------ xen/common/gzip/inflate.c | 17 ++++++++--------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/xen/common/gzip/gunzip.c b/xen/common/gzip/gunzip.c index e47f10ae19ad..11bfe45d8222 100644 --- a/xen/common/gzip/gunzip.c +++ b/xen/common/gzip/gunzip.c @@ -8,6 +8,8 @@ struct gunzip_state { unsigned char *window; + /* window pointer: */ + unsigned int wp; }; static unsigned char *__initdata inbuf; @@ -16,9 +18,6 @@ static unsigned int __initdata insize; /* Index of next byte to be processed in inbuf: */ static unsigned int __initdata inptr; -/* Bytes in output buffer: */ -static unsigned int __initdata outcnt; - #define malloc(a) xmalloc_bytes(a) #define free(a) xfree(a) #define memzero(s, n) memset((s), 0, (n)) @@ -75,15 +74,15 @@ static __init void flush_window(struct gunzip_state *s) unsigned char *in, ch; in = s->window; - for ( n = 0; n < outcnt; n++ ) + for ( n = 0; n < s->wp; n++ ) { ch = *in++; c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); } crc = c; - bytes_out += (unsigned long)outcnt; - outcnt = 0; + bytes_out += (unsigned long)s->wp; + s->wp = 0; } __init int gzip_check(char *image, unsigned long image_len) diff --git a/xen/common/gzip/inflate.c b/xen/common/gzip/inflate.c index 5fa5c039c6d1..78b2f20a97ba 100644 --- a/xen/common/gzip/inflate.c +++ b/xen/common/gzip/inflate.c @@ -130,7 +130,6 @@ static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #"; * "uch *window;" and then malloc'ed in the latter case. The definition * must be in unzip.h, included above. */ -#define wp outcnt /* * Huffman code lookup table entry--this entry is four bytes for machines @@ -556,7 +555,7 @@ static int __init inflate_codes( /* make local copies of globals */ b = bb; /* initialize bit buffer */ k = bk; - w = wp; /* initialize window position */ + w = s->wp; /* initialize window position */ /* inflate the coded data */ ml = mask_bits[bl]; /* precompute masks for speed */ @@ -579,7 +578,7 @@ static int __init inflate_codes( Tracevv((stderr, "%c", s->window[w-1])); if (w == WSIZE) { - wp = w; + s->wp = w; flush_window(s); w = 0; } @@ -627,7 +626,7 @@ static int __init inflate_codes( } while (--e); if (w == WSIZE) { - wp = w; + s->wp = w; flush_window(s); w = 0; } @@ -636,7 +635,7 @@ static int __init inflate_codes( } /* restore the globals from the locals */ - wp = w; /* restore global window pointer */ + s->wp = w; /* restore global window pointer */ bb = b; /* restore global bit buffer */ bk = k; @@ -657,7 +656,7 @@ static int __init inflate_stored(struct gunzip_state *s) /* make local copies of globals */ b = bb; /* initialize bit buffer */ k = bk; - w = wp; /* initialize window position */ + w = s->wp; /* initialize window position */ /* go to byte boundary */ @@ -681,7 +680,7 @@ static int __init inflate_stored(struct gunzip_state *s) s->window[w++] = (uch)b; if (w == WSIZE) { - wp = w; + s->wp = w; flush_window(s); w = 0; } @@ -689,7 +688,7 @@ static int __init inflate_stored(struct gunzip_state *s) } /* restore the globals from the locals */ - wp = w; /* restore global window pointer */ + s->wp = w; /* restore global window pointer */ bb = b; /* restore global bit buffer */ bk = k; @@ -1004,7 +1003,7 @@ static int __init inflate(struct gunzip_state *s) int r; /* result code */ /* initialize window, bit buffer */ - wp = 0; + s->wp = 0; bk = 0; bb = 0; -- 2.30.2
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |