Commit ea8582b1 authored by Steven Cole's avatar Steven Cole Committed by Linus Torvalds

[PATCH] Another final K&R to ANSI C cleanup of zlib

Here is another final K&R to ANSI C cleanup patch for zlib.
parent 164fff87
...@@ -371,9 +371,10 @@ int zlib_deflateParams( ...@@ -371,9 +371,10 @@ int zlib_deflateParams(
* IN assertion: the stream state is correct and there is enough room in * IN assertion: the stream state is correct and there is enough room in
* pending_buf. * pending_buf.
*/ */
local void putShortMSB (s, b) local void putShortMSB(
deflate_state *s; deflate_state *s,
uInt b; uInt b
)
{ {
put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b >> 8));
put_byte(s, (Byte)(b & 0xff)); put_byte(s, (Byte)(b & 0xff));
...@@ -385,8 +386,9 @@ local void putShortMSB (s, b) ...@@ -385,8 +386,9 @@ local void putShortMSB (s, b)
* to avoid allocating a large strm->next_out buffer and copying into it. * to avoid allocating a large strm->next_out buffer and copying into it.
* (See also read_buf()). * (See also read_buf()).
*/ */
local void flush_pending(strm) local void flush_pending(
z_streamp strm; z_streamp strm
)
{ {
deflate_state *s = (deflate_state *) strm->state; deflate_state *s = (deflate_state *) strm->state;
unsigned len = s->pending; unsigned len = s->pending;
...@@ -656,8 +658,9 @@ local int read_buf( ...@@ -656,8 +658,9 @@ local int read_buf(
/* =========================================================================== /* ===========================================================================
* Initialize the "longest match" routines for a new zlib stream * Initialize the "longest match" routines for a new zlib stream
*/ */
local void lm_init (s) local void lm_init(
deflate_state *s; deflate_state *s
)
{ {
s->window_size = (ulg)2L*s->w_size; s->window_size = (ulg)2L*s->w_size;
...@@ -690,9 +693,10 @@ local void lm_init (s) ...@@ -690,9 +693,10 @@ local void lm_init (s)
/* For 80x86 and 680x0, an optimized version will be provided in match.asm or /* For 80x86 and 680x0, an optimized version will be provided in match.asm or
* match.S. The code will be functionally equivalent. * match.S. The code will be functionally equivalent.
*/ */
local uInt longest_match(s, cur_match) local uInt longest_match(
deflate_state *s; deflate_state *s,
IPos cur_match; /* current match */ IPos cur_match /* current match */
)
{ {
unsigned chain_length = s->max_chain_length;/* max hash chain length */ unsigned chain_length = s->max_chain_length;/* max hash chain length */
register Byte *scan = s->window + s->strstart; /* current string */ register Byte *scan = s->window + s->strstart; /* current string */
...@@ -832,10 +836,12 @@ local uInt longest_match(s, cur_match) ...@@ -832,10 +836,12 @@ local uInt longest_match(s, cur_match)
/* =========================================================================== /* ===========================================================================
* Check that the match at match_start is indeed a match. * Check that the match at match_start is indeed a match.
*/ */
local void check_match(s, start, match, length) local void check_match(
deflate_state *s; deflate_state *s,
IPos start, match; IPos start,
int length; IPos match,
int length
)
{ {
/* check that the match is indeed a match */ /* check that the match is indeed a match */
if (memcmp((char *)s->window + match, if (memcmp((char *)s->window + match,
...@@ -985,9 +991,10 @@ local void fill_window(s) ...@@ -985,9 +991,10 @@ local void fill_window(s)
* NOTE: this function should be optimized to avoid extra copying from * NOTE: this function should be optimized to avoid extra copying from
* window to pending_buf. * window to pending_buf.
*/ */
local block_state deflate_stored(s, flush) local block_state deflate_stored(
deflate_state *s; deflate_state *s,
int flush; int flush
)
{ {
/* Stored blocks are limited to 0xffff bytes, pending_buf is limited /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
* to pending_buf_size, and each stored block has a 5 byte header: * to pending_buf_size, and each stored block has a 5 byte header:
...@@ -1043,9 +1050,10 @@ local block_state deflate_stored(s, flush) ...@@ -1043,9 +1050,10 @@ local block_state deflate_stored(s, flush)
* new strings in the dictionary only for unmatched strings or for short * new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options. * matches. It is used only for the fast compression options.
*/ */
local block_state deflate_fast(s, flush) local block_state deflate_fast(
deflate_state *s; deflate_state *s,
int flush; int flush
)
{ {
IPos hash_head = NIL; /* head of the hash chain */ IPos hash_head = NIL; /* head of the hash chain */
int bflush; /* set if current block must be flushed */ int bflush; /* set if current block must be flushed */
...@@ -1136,9 +1144,10 @@ local block_state deflate_fast(s, flush) ...@@ -1136,9 +1144,10 @@ local block_state deflate_fast(s, flush)
* evaluation for matches: a match is finally adopted only if there is * evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position. * no better match at the next window position.
*/ */
local block_state deflate_slow(s, flush) local block_state deflate_slow(
deflate_state *s; deflate_state *s,
int flush; int flush
)
{ {
IPos hash_head = NIL; /* head of hash chain */ IPos hash_head = NIL; /* head of hash chain */
int bflush; /* set if current block must be flushed */ int bflush; /* set if current block must be flushed */
......
...@@ -226,7 +226,7 @@ local void send_bits( ...@@ -226,7 +226,7 @@ local void send_bits(
* this function may be called by two threads concurrently, but this is * this function may be called by two threads concurrently, but this is
* harmless since both invocations do exactly the same thing. * harmless since both invocations do exactly the same thing.
*/ */
local void tr_static_init() local void tr_static_init(void)
{ {
static int static_init_done = 0; static int static_init_done = 0;
int n; /* iterates over tree elements */ int n; /* iterates over tree elements */
...@@ -296,8 +296,9 @@ local void tr_static_init() ...@@ -296,8 +296,9 @@ local void tr_static_init()
/* =========================================================================== /* ===========================================================================
* Initialize the tree data structures for a new zlib stream. * Initialize the tree data structures for a new zlib stream.
*/ */
void zlib_tr_init(s) void zlib_tr_init(
deflate_state *s; deflate_state *s
)
{ {
tr_static_init(); tr_static_init();
...@@ -326,8 +327,9 @@ void zlib_tr_init(s) ...@@ -326,8 +327,9 @@ void zlib_tr_init(s)
/* =========================================================================== /* ===========================================================================
* Initialize a new block. * Initialize a new block.
*/ */
local void init_block(s) local void init_block(
deflate_state *s; deflate_state *s
)
{ {
int n; /* iterates over tree elements */ int n; /* iterates over tree elements */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment