[master] 3df9cdc1e Bite the bullet, and eliminate K&R functions in libvgz, in the most diff-friendly way.

Poul-Henning Kamp phk at FreeBSD.org
Tue Jun 20 08:53:09 UTC 2023


commit 3df9cdc1eda72ec736c603b818387fb8ab825569
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jun 20 08:36:55 2023 +0000

    Bite the bullet, and eliminate K&R functions in libvgz,
    in the most diff-friendly way.
    
    If Mark Adler ever decides that the 21st century is real thing, we
    will adopt his diff.
    
    This should allow us to revert 79c7d17543d86

diff --git a/lib/libvgz/adler32.c b/lib/libvgz/adler32.c
index ef1ae7e79..7a3d10ccc 100644
--- a/lib/libvgz/adler32.c
+++ b/lib/libvgz/adler32.c
@@ -186,10 +186,11 @@ uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
     return adler32_combine_(adler1, adler2, len2);
 }
 #else /* NOVGZ */
-uLong ZEXPORT adler32(adler, buf, len)
-    uLong adler;
-    const Bytef *buf;
-    uInt len;
+uLong ZEXPORT adler32(
+    uLong adler,
+    const Bytef *buf,
+    uInt len
+)
 {
 	(void)adler;
 	(void)buf;
diff --git a/lib/libvgz/crc32.c b/lib/libvgz/crc32.c
index 6eab5e951..32c6d5b77 100644
--- a/lib/libvgz/crc32.c
+++ b/lib/libvgz/crc32.c
@@ -125,8 +125,9 @@ local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
  */
 local z_word_t byte_swap OF((z_word_t word));
 
-local z_word_t byte_swap(word)
-    z_word_t word;
+local z_word_t byte_swap(
+    z_word_t word
+)
 {
 #  if W == 8
     return
@@ -550,9 +551,10 @@ local void braid(ltl, big, n, w)
   Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
   reflected. For speed, this requires that a not be zero.
  */
-local z_crc_t multmodp(a, b)
-    z_crc_t a;
-    z_crc_t b;
+local z_crc_t multmodp(
+    z_crc_t a,
+    z_crc_t b
+)
 {
     z_crc_t m, p;
 
@@ -574,9 +576,10 @@ local z_crc_t multmodp(a, b)
   Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been
   initialized.
  */
-local z_crc_t x2nmodp(n, k)
-    z_off64_t n;
-    unsigned k;
+local z_crc_t x2nmodp(
+    z_off64_t n,
+    unsigned k
+)
 {
     z_crc_t p;
 
@@ -594,7 +597,7 @@ local z_crc_t x2nmodp(n, k)
  * This function can be used by asm versions of crc32(), and to force the
  * generation of the CRC tables in a threaded application.
  */
-const z_crc_t FAR * ZEXPORT get_crc_table()
+const z_crc_t FAR * ZEXPORT get_crc_table(void)
 {
 #ifdef DYNAMIC_CRC_TABLE
     once(&made, make_crc_table);
@@ -727,8 +730,9 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
  */
 local z_crc_t crc_word OF((z_word_t data));
 
-local z_crc_t crc_word(data)
-    z_word_t data;
+local z_crc_t crc_word(
+    z_word_t data
+)
 {
     int k;
     for (k = 0; k < W; k++)
@@ -738,8 +742,9 @@ local z_crc_t crc_word(data)
 
 local z_word_t crc_word_big OF((z_word_t data));
 
-local z_word_t crc_word_big(data)
-    z_word_t data;
+local z_word_t crc_word_big(
+    z_word_t data
+)
 {
     int k;
     for (k = 0; k < W; k++)
@@ -751,10 +756,11 @@ local z_word_t crc_word_big(data)
 #endif
 
 /* ========================================================================= */
-unsigned long ZEXPORT crc32_z(crc, buf, len)
-    unsigned long crc;
-    const unsigned char FAR *buf;
-    z_size_t len;
+unsigned long ZEXPORT crc32_z(
+    unsigned long crc,
+    const unsigned char FAR *buf,
+    z_size_t len
+)
 {
     /* Return initial CRC, if requested. */
     if (buf == Z_NULL) return 0;
@@ -1075,19 +1081,21 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
 #endif
 
 /* ========================================================================= */
-unsigned long ZEXPORT crc32(crc, buf, len)
-    unsigned long crc;
-    const unsigned char FAR *buf;
-    uInt len;
+unsigned long ZEXPORT crc32(
+    unsigned long crc,
+    const unsigned char FAR *buf,
+    uInt len
+)
 {
     return crc32_z(crc, buf, len);
 }
 
 /* ========================================================================= */
-uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
-    uLong crc1;
-    uLong crc2;
-    z_off64_t len2;
+uLong ZEXPORT crc32_combine64(
+    uLong crc1,
+    uLong crc2,
+    z_off64_t len2
+)
 {
 #ifdef DYNAMIC_CRC_TABLE
     once(&made, make_crc_table);
@@ -1096,17 +1104,19 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
 }
 
 /* ========================================================================= */
-uLong ZEXPORT crc32_combine(crc1, crc2, len2)
-    uLong crc1;
-    uLong crc2;
-    z_off_t len2;
+uLong ZEXPORT crc32_combine(
+    uLong crc1,
+    uLong crc2,
+    z_off_t len2
+)
 {
     return crc32_combine64(crc1, crc2, (z_off64_t)len2);
 }
 
 /* ========================================================================= */
-uLong ZEXPORT crc32_combine_gen64(len2)
-    z_off64_t len2;
+uLong ZEXPORT crc32_combine_gen64(
+    z_off64_t len2
+)
 {
 #ifdef DYNAMIC_CRC_TABLE
     once(&made, make_crc_table);
@@ -1115,17 +1125,19 @@ uLong ZEXPORT crc32_combine_gen64(len2)
 }
 
 /* ========================================================================= */
-uLong ZEXPORT crc32_combine_gen(len2)
-    z_off_t len2;
+uLong ZEXPORT crc32_combine_gen(
+    z_off_t len2
+)
 {
     return crc32_combine_gen64((z_off64_t)len2);
 }
 
 /* ========================================================================= */
-uLong ZEXPORT crc32_combine_op(crc1, crc2, op)
-    uLong crc1;
-    uLong crc2;
-    uLong op;
+uLong ZEXPORT crc32_combine_op(
+    uLong crc1,
+    uLong crc2,
+    uLong op
+)
 {
     return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
 }
diff --git a/lib/libvgz/deflate.c b/lib/libvgz/deflate.c
index 75277afd4..32b395342 100644
--- a/lib/libvgz/deflate.c
+++ b/lib/libvgz/deflate.c
@@ -198,8 +198,9 @@ local const config configuration_table[10] = {
  * bit values at the expense of memory usage). We slide even when level == 0 to
  * keep the hash table consistent if we switch back to level > 0 later.
  */
-local void slide_hash(s)
-    deflate_state *s;
+local void slide_hash(
+    deflate_state *s
+)
 {
     unsigned n, m;
     Posf *p;
@@ -241,16 +242,16 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size)
 #endif /* NOVGZ */
 
 /* ========================================================================= */
-int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
-                  version, stream_size)
-    z_streamp strm;
-    int  level;
-    int  method;
-    int  windowBits;
-    int  memLevel;
-    int  strategy;
-    const char *version;
-    int stream_size;
+int ZEXPORT deflateInit2_(
+    z_streamp strm,
+    int  level,
+    int  method,
+    int  windowBits,
+    int  memLevel,
+    int  strategy,
+    const char *version,
+    int stream_size
+)
 {
     deflate_state *s;
     int wrap = 1;
@@ -393,8 +394,9 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
 /* =========================================================================
  * Check for a valid deflate stream state. Return 0 if ok, 1 if not.
  */
-local int deflateStateCheck (strm)
-    z_streamp strm;
+local int deflateStateCheck (
+    z_streamp strm
+)
 {
     deflate_state *s;
     if (strm == Z_NULL ||
@@ -513,8 +515,9 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength)
 #endif /* NOVGZ */
 
 /* ========================================================================= */
-int ZEXPORT deflateResetKeep (strm)
-    z_streamp strm;
+int ZEXPORT deflateResetKeep (
+    z_streamp strm
+)
 {
     deflate_state *s;
 
@@ -552,8 +555,9 @@ int ZEXPORT deflateResetKeep (strm)
 }
 
 /* ========================================================================= */
-int ZEXPORT deflateReset (strm)
-    z_streamp strm;
+int ZEXPORT deflateReset (
+    z_streamp strm
+)
 {
     int ret;
 
@@ -566,9 +570,10 @@ int ZEXPORT deflateReset (strm)
 #ifdef NOVGZ
 
 /* ========================================================================= */
-int ZEXPORT deflateSetHeader (strm, head)
-    z_streamp strm;
-    gz_headerp head;
+int ZEXPORT deflateSetHeader (
+    z_streamp strm,
+    gz_headerp head
+)
 {
     if (deflateStateCheck(strm) || strm->state->wrap != 2)
         return Z_STREAM_ERROR;
@@ -577,10 +582,11 @@ int ZEXPORT deflateSetHeader (strm, head)
 }
 
 /* ========================================================================= */
-int ZEXPORT deflatePending (strm, pending, bits)
-    unsigned *pending;
-    int *bits;
-    z_streamp strm;
+int ZEXPORT deflatePending (
+    z_streamp strm,
+    unsigned *pending,
+    int *bits
+)
 {
     if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
     if (pending != Z_NULL)
@@ -783,9 +789,10 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
  * IN assertion: the stream state is correct and there is enough room in
  * pending_buf.
  */
-local void putShortMSB (s, b)
-    deflate_state *s;
-    uInt b;
+local void putShortMSB (
+    deflate_state *s,
+    uInt b
+)
 {
     put_byte(s, (Byte)(b >> 8));
     put_byte(s, (Byte)(b & 0xff));
@@ -797,8 +804,9 @@ local void putShortMSB (s, b)
  * applications may wish to modify it to avoid allocating a large
  * strm->next_out buffer and copying into it. (See also read_buf()).
  */
-local void flush_pending(strm)
-    z_streamp strm;
+local void flush_pending(
+    z_streamp strm
+)
 {
     unsigned len;
     deflate_state *s = strm->state;
@@ -830,9 +838,10 @@ local void flush_pending(strm)
     } while (0)
 
 /* ========================================================================= */
-int ZEXPORT deflate (strm, flush)
-    z_streamp strm;
-    int flush;
+int ZEXPORT deflate (
+    z_streamp strm,
+    int flush
+)
 {
     int old_flush; /* value of flush param for previous deflate call */
     deflate_state *s;
@@ -1158,8 +1167,9 @@ int ZEXPORT deflate (strm, flush)
 }
 
 /* ========================================================================= */
-int ZEXPORT deflateEnd (strm)
-    z_streamp strm;
+int ZEXPORT deflateEnd (
+    z_streamp strm
+)
 {
     int status;
 
@@ -1247,10 +1257,11 @@ int ZEXPORT deflateCopy (dest, source)
  * allocating a large strm->next_in buffer and copying from it.
  * (See also flush_pending()).
  */
-local unsigned read_buf(strm, buf, size)
-    z_streamp strm;
-    Bytef *buf;
-    unsigned size;
+local unsigned read_buf(
+    z_streamp strm,
+    Bytef *buf,
+    unsigned size
+)
 {
     unsigned len = strm->avail_in;
 
@@ -1277,8 +1288,9 @@ local unsigned read_buf(strm, buf, size)
 /* ===========================================================================
  * Initialize the "longest match" routines for a new zlib stream
  */
-local void lm_init (s)
-    deflate_state *s;
+local void lm_init (
+    deflate_state *s
+)
 {
     s->window_size = (ulg)2L*s->w_size;
 
@@ -1310,9 +1322,10 @@ local void lm_init (s)
  *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
  * OUT assertion: the match length is not greater than s->lookahead.
  */
-local uInt longest_match(s, cur_match)
-    deflate_state *s;
-    IPos cur_match;                             /* current match */
+local uInt longest_match(
+    deflate_state *s,
+    IPos cur_match                             /* current match */
+)
 {
     unsigned chain_length = s->max_chain_length;/* max hash chain length */
     register Bytef *scan = s->window + s->strstart; /* current string */
@@ -1559,8 +1572,9 @@ local void check_match(s, start, match, length)
  *    performed for at least two bytes (required for the zip translate_eol
  *    option -- not supported here).
  */
-local void fill_window(s)
-    deflate_state *s;
+local void fill_window(
+    deflate_state *s
+)
 {
     unsigned n;
     unsigned more;    /* Amount of free space at the end of the window. */
@@ -1724,9 +1738,10 @@ local void fill_window(s)
  * copied. It is most efficient with large input and output buffers, which
  * maximizes the opportunities to have a single copy from next_in to next_out.
  */
-local block_state deflate_stored(s, flush)
-    deflate_state *s;
-    int flush;
+local block_state deflate_stored(
+    deflate_state *s,
+    int flush
+)
 {
     /* Smallest worthy block size when not flushing or finishing. By default
      * this is 32K. This can be as small as 507 bytes for memLevel == 1. For
@@ -1914,9 +1929,10 @@ local block_state deflate_stored(s, flush)
  * new strings in the dictionary only for unmatched strings or for short
  * matches. It is used only for the fast compression options.
  */
-local block_state deflate_fast(s, flush)
-    deflate_state *s;
-    int flush;
+local block_state deflate_fast(
+    deflate_state *s,
+    int flush
+)
 {
     IPos hash_head;       /* head of the hash chain */
     int bflush;           /* set if current block must be flushed */
@@ -2016,9 +2032,10 @@ local block_state deflate_fast(s, flush)
  * evaluation for matches: a match is finally adopted only if there is
  * no better match at the next window position.
  */
-local block_state deflate_slow(s, flush)
-    deflate_state *s;
-    int flush;
+local block_state deflate_slow(
+    deflate_state *s,
+    int flush
+)
 {
     IPos hash_head;          /* head of hash chain */
     int bflush;              /* set if current block must be flushed */
diff --git a/lib/libvgz/inffast.c b/lib/libvgz/inffast.c
index 903ebfae1..01b00436b 100644
--- a/lib/libvgz/inffast.c
+++ b/lib/libvgz/inffast.c
@@ -47,9 +47,10 @@
       requires strm->avail_out >= 258 for each loop to avoid checking for
       output space.
  */
-void ZLIB_INTERNAL inflate_fast(strm, start)
-z_streamp strm;
-unsigned start;         /* inflate()'s starting value for strm->avail_out */
+void ZLIB_INTERNAL inflate_fast(
+    z_streamp strm,
+    unsigned start         /* inflate()'s starting value for strm->avail_out */
+)
 {
     struct inflate_state FAR *state;
     z_const unsigned char FAR *in;      /* local strm->next_in */
diff --git a/lib/libvgz/inflate.c b/lib/libvgz/inflate.c
index 5cdbe8b95..cfd708391 100644
--- a/lib/libvgz/inflate.c
+++ b/lib/libvgz/inflate.c
@@ -104,8 +104,9 @@ local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
                               unsigned len));
 #endif /* NOVGZ */
 
-local int inflateStateCheck(strm)
-z_streamp strm;
+local int inflateStateCheck(
+    z_streamp strm
+)
 {
     struct inflate_state FAR *state;
     if (strm == Z_NULL ||
@@ -118,8 +119,9 @@ z_streamp strm;
     return 0;
 }
 
-int ZEXPORT inflateResetKeep(strm)
-z_streamp strm;
+int ZEXPORT inflateResetKeep(
+    z_streamp strm
+)
 {
     struct inflate_state FAR *state;
 
@@ -145,8 +147,9 @@ z_streamp strm;
     return Z_OK;
 }
 
-int ZEXPORT inflateReset(strm)
-z_streamp strm;
+int ZEXPORT inflateReset(
+    z_streamp strm
+)
 {
     struct inflate_state FAR *state;
 
@@ -158,9 +161,10 @@ z_streamp strm;
     return inflateResetKeep(strm);
 }
 
-int ZEXPORT inflateReset2(strm, windowBits)
-z_streamp strm;
-int windowBits;
+int ZEXPORT inflateReset2(
+    z_streamp strm,
+    int windowBits
+)
 {
     int wrap;
     struct inflate_state FAR *state;
@@ -198,11 +202,12 @@ int windowBits;
     return inflateReset(strm);
 }
 
-int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
-z_streamp strm;
-int windowBits;
-const char *version;
-int stream_size;
+int ZEXPORT inflateInit2_(
+    z_streamp strm,
+    int windowBits,
+    const char *version,
+    int stream_size
+)
 {
     int ret;
     struct inflate_state FAR *state;
@@ -244,18 +249,20 @@ int stream_size;
 
 #ifdef NOVGZ
 
-int ZEXPORT inflateInit_(strm, version, stream_size)
-z_streamp strm;
-const char *version;
-int stream_size;
+int ZEXPORT inflateInit_(
+    z_streamp strm,
+    const char *version,
+    int stream_size
+)
 {
     return inflateInit2_(strm, DEF_WBITS, version, stream_size);
 }
 
-int ZEXPORT inflatePrime(strm, bits, value)
-z_streamp strm;
-int bits;
-int value;
+int ZEXPORT inflatePrime(
+    z_streamp strm,
+    int bits,
+    int value
+)
 {
     struct inflate_state FAR *state;
 
@@ -285,8 +292,9 @@ int value;
    used for threaded applications, since the rewriting of the tables and virgin
    may not be thread-safe.
  */
-local void fixedtables(state)
-struct inflate_state FAR *state;
+local void fixedtables(
+    struct inflate_state FAR *state
+)
 {
 #ifdef BUILDFIXED
     static int virgin = 1;
@@ -403,10 +411,11 @@ void makefixed()
    output will fall in the output data, making match copies simpler and faster.
    The advantage may be dependent on the size of the processor's data caches.
  */
-local int updatewindow(strm, end, copy)
-z_streamp strm;
-const Bytef *end;
-unsigned copy;
+local int updatewindow(
+    z_streamp strm,
+    const Bytef *end,
+    unsigned copy
+)
 {
     struct inflate_state FAR *state;
     unsigned dist;
@@ -629,9 +638,10 @@ unsigned copy;
    will return Z_BUF_ERROR if it has not reached the end of the stream.
  */
 
-int ZEXPORT inflate(strm, flush)
-z_streamp strm;
-int flush;
+int ZEXPORT inflate(
+    z_streamp strm,
+    int flush
+)
 {
     struct inflate_state FAR *state;
     z_const unsigned char FAR *next;    /* next input */
@@ -1313,8 +1323,9 @@ int flush;
     return ret;
 }
 
-int ZEXPORT inflateEnd(strm)
-z_streamp strm;
+int ZEXPORT inflateEnd(
+    z_streamp strm
+)
 {
     struct inflate_state FAR *state;
     if (inflateStateCheck(strm))
diff --git a/lib/libvgz/inftrees.c b/lib/libvgz/inftrees.c
index 18faf783c..a794b0e27 100644
--- a/lib/libvgz/inftrees.c
+++ b/lib/libvgz/inftrees.c
@@ -30,13 +30,14 @@ const char inflate_copyright[] =
    table index bits.  It will differ if the request is greater than the
    longest code or if it is less than the shortest code.
  */
-int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
-codetype type;
-unsigned short FAR *lens;
-unsigned codes;
-code FAR * FAR *table;
-unsigned FAR *bits;
-unsigned short FAR *work;
+int ZLIB_INTERNAL inflate_table(
+    codetype type,
+    unsigned short FAR *lens,
+    unsigned codes,
+    code FAR * FAR *table,
+    unsigned FAR *bits,
+    unsigned short FAR *work
+)
 {
     unsigned len;               /* a code's length in bits */
     unsigned sym;               /* index of code symbols */
diff --git a/lib/libvgz/trees.c b/lib/libvgz/trees.c
index 1ccce63e6..87b5c5f32 100644
--- a/lib/libvgz/trees.c
+++ b/lib/libvgz/trees.c
@@ -229,7 +229,7 @@ local void send_bits(s, value, length)
 /* ===========================================================================
  * Initialize the various 'constant' tables.
  */
-local void tr_static_init()
+local void tr_static_init(void)
 {
 #if defined(GEN_TREES_H) || !defined(STDC)
     static int static_init_done = 0;
@@ -376,8 +376,9 @@ void gen_trees_header()
 /* ===========================================================================
  * Initialize the tree data structures for a new zlib stream.
  */
-void ZLIB_INTERNAL _tr_init(s)
-    deflate_state *s;
+void ZLIB_INTERNAL _tr_init(
+    deflate_state *s
+)
 {
     tr_static_init();
 
@@ -404,8 +405,9 @@ void ZLIB_INTERNAL _tr_init(s)
 /* ===========================================================================
  * Initialize a new block.
  */
-local void init_block(s)
-    deflate_state *s;
+local void init_block(
+    deflate_state *s
+)
 {
     int n; /* iterates over tree elements */
 
@@ -448,10 +450,11 @@ local void init_block(s)
  * when the heap property is re-established (each father smaller than its
  * two sons).
  */
-local void pqdownheap(s, tree, k)
-    deflate_state *s;
-    ct_data *tree;  /* the tree to restore */
-    int k;               /* node to move down */
+local void pqdownheap(
+    deflate_state *s,
+    ct_data *tree,  /* the tree to restore */
+    int k               /* node to move down */
+)
 {
     int v = s->heap[k];
     int j = k << 1;  /* left son of k */
@@ -483,9 +486,10 @@ local void pqdownheap(s, tree, k)
  *     The length opt_len is updated; static_len is also updated if stree is
  *     not null.
  */
-local void gen_bitlen(s, desc)
-    deflate_state *s;
-    tree_desc *desc;    /* the tree descriptor */
+local void gen_bitlen(
+    deflate_state *s,
+    tree_desc *desc    /* the tree descriptor */
+)
 {
     ct_data *tree        = desc->dyn_tree;
     int max_code         = desc->max_code;
@@ -569,10 +573,11 @@ local void gen_bitlen(s, desc)
  * OUT assertion: the field code is set for all tree elements of non
  *     zero code length.
  */
-local void gen_codes (tree, max_code, bl_count)
-    ct_data *tree;             /* the tree to decorate */
-    int max_code;              /* largest code with non zero frequency */
-    ushf *bl_count;            /* number of codes at each bit length */
+local void gen_codes (
+    ct_data *tree,             /* the tree to decorate */
+    int max_code,              /* largest code with non zero frequency */
+    ushf *bl_count             /* number of codes at each bit length */
+)
 {
     ush next_code[MAX_BITS+1]; /* next code value for each bit length */
     unsigned code = 0;         /* running code value */
@@ -612,9 +617,10 @@ local void gen_codes (tree, max_code, bl_count)
  *     and corresponding code. The length opt_len is updated; static_len is
  *     also updated if stree is not null. The field max_code is set.
  */
-local void build_tree(s, desc)
-    deflate_state *s;
-    tree_desc *desc; /* the tree descriptor */
+local void build_tree(
+    deflate_state *s,
+    tree_desc *desc /* the tree descriptor */
+)
 {
     ct_data *tree         = desc->dyn_tree;
     const ct_data *stree  = desc->stat_desc->static_tree;
@@ -700,10 +706,11 @@ local void build_tree(s, desc)
  * Scan a literal or distance tree to determine the frequencies of the codes
  * in the bit length tree.
  */
-local void scan_tree (s, tree, max_code)
-    deflate_state *s;
-    ct_data *tree;   /* the tree to be scanned */
-    int max_code;    /* and its largest code of non zero frequency */
+local void scan_tree (
+    deflate_state *s,
+    ct_data *tree,   /* the tree to be scanned */
+    int max_code     /* and its largest code of non zero frequency */
+)
 {
     int n;                     /* iterates over all tree elements */
     int prevlen = -1;          /* last emitted length */
@@ -745,10 +752,11 @@ local void scan_tree (s, tree, max_code)
  * Send a literal or distance tree in compressed form, using the codes in
  * bl_tree.
  */
-local void send_tree (s, tree, max_code)
-    deflate_state *s;
-    ct_data *tree; /* the tree to be scanned */
-    int max_code;       /* and its largest code of non zero frequency */
+local void send_tree (
+    deflate_state *s,
+    ct_data *tree, /* the tree to be scanned */
+    int max_code       /* and its largest code of non zero frequency */
+)
 {
     int n;                     /* iterates over all tree elements */
     int prevlen = -1;          /* last emitted length */
@@ -796,8 +804,9 @@ local void send_tree (s, tree, max_code)
  * Construct the Huffman tree for the bit lengths and return the index in
  * bl_order of the last bit length code to send.
  */
-local int build_bl_tree(s)
-    deflate_state *s;
+local int build_bl_tree(
+    deflate_state *s
+)
 {
     int max_blindex;  /* index of last bit length code of non zero freq */
 
@@ -831,9 +840,12 @@ local int build_bl_tree(s)
  * lengths of the bit length codes, the literal tree and the distance tree.
  * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
  */
-local void send_all_trees(s, lcodes, dcodes, blcodes)
-    deflate_state *s;
-    int lcodes, dcodes, blcodes; /* number of codes for each tree */
+local void send_all_trees(
+    deflate_state *s,
+    int lcodes,
+    int dcodes,
+    int blcodes /* number of codes for each tree */
+)
 {
     int rank;                    /* index in bl_order */
 
@@ -860,11 +872,12 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
 /* ===========================================================================
  * Send a stored block
  */
-void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
-    deflate_state *s;
-    charf *buf;       /* input block */
-    ulg stored_len;   /* length of input block */
-    int last;         /* one if this is the last block for a file */
+void ZLIB_INTERNAL _tr_stored_block(
+    deflate_state *s,
+    charf *buf,       /* input block */
+    ulg stored_len,   /* length of input block */
+    int last          /* one if this is the last block for a file */
+)
 {
     if (last)
         s->strm->last_bit =
@@ -891,8 +904,9 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
 /* ===========================================================================
  * Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
  */
-void ZLIB_INTERNAL _tr_flush_bits(s)
-    deflate_state *s;
+void ZLIB_INTERNAL _tr_flush_bits(
+    deflate_state *s
+)
 {
     bi_flush(s);
 }
@@ -901,8 +915,9 @@ void ZLIB_INTERNAL _tr_flush_bits(s)
  * Send one empty static block to give enough lookahead for inflate.
  * This takes 10 bits, of which 7 may remain in the bit buffer.
  */
-void ZLIB_INTERNAL _tr_align(s)
-    deflate_state *s;
+void ZLIB_INTERNAL _tr_align(
+    deflate_state *s
+)
 {
     send_bits(s, STATIC_TREES<<1, 3);
     send_code(s, END_BLOCK, static_ltree);
@@ -916,11 +931,12 @@ void ZLIB_INTERNAL _tr_align(s)
  * Determine the best encoding for the current block: dynamic trees, static
  * trees or store, and write out the encoded block.
  */
-void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
-    deflate_state *s;
-    charf *buf;       /* input block, or NULL if too old */
-    ulg stored_len;   /* length of input block */
-    int last;         /* one if this is the last block for a file */
+void ZLIB_INTERNAL _tr_flush_block(
+    deflate_state *s,
+    charf *buf,       /* input block, or NULL if too old */
+    ulg stored_len,   /* length of input block */
+    int last          /* one if this is the last block for a file */
+)
 {
     ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
     int max_blindex = 0;  /* index of last bit length code of non zero freq */
@@ -1024,10 +1040,11 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
  * Save the match info and tally the frequency counts. Return true if
  * the current block must be flushed.
  */
-int ZLIB_INTERNAL _tr_tally (s, dist, lc)
-    deflate_state *s;
-    unsigned dist;  /* distance of matched string */
-    unsigned lc;    /* match length - MIN_MATCH or unmatched char (dist==0) */
+int ZLIB_INTERNAL _tr_tally (
+    deflate_state *s,
+    unsigned dist,  /* distance of matched string */
+    unsigned lc     /* match length - MIN_MATCH or unmatched char (dist==0) */
+)
 {
     s->sym_buf[s->sym_next++] = (uch)dist;
     s->sym_buf[s->sym_next++] = (uch)(dist >> 8);
@@ -1052,10 +1069,11 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
 /* ===========================================================================
  * Send the block data compressed using the given Huffman trees
  */
-local void compress_block(s, ltree, dtree)
-    deflate_state *s;
-    const ct_data *ltree; /* literal tree */
-    const ct_data *dtree; /* distance tree */
+local void compress_block(
+    deflate_state *s,
+    const ct_data *ltree, /* literal tree */
+    const ct_data *dtree  /* distance tree */
+)
 {
     unsigned dist;      /* distance of matched string */
     int lc;             /* match length or unmatched char (if dist == 0) */
@@ -1112,8 +1130,9 @@ local void compress_block(s, ltree, dtree)
  *   (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
  * IN assertion: the fields Freq of dyn_ltree are set.
  */
-local int detect_data_type(s)
-    deflate_state *s;
+local int detect_data_type(
+    deflate_state *s
+)
 {
     /* block_mask is the bit mask of block-listed bytes
      * set bits 0..6, 14..25, and 28..31
@@ -1146,9 +1165,10 @@ local int detect_data_type(s)
  * method would use a table)
  * IN assertion: 1 <= len <= 15
  */
-local unsigned bi_reverse(code, len)
-    unsigned code; /* the value to invert */
-    int len;       /* its bit length */
+local unsigned bi_reverse(
+    unsigned code, /* the value to invert */
+    int len        /* its bit length */
+)
 {
     register unsigned res = 0;
     do {
@@ -1161,8 +1181,9 @@ local unsigned bi_reverse(code, len)
 /* ===========================================================================
  * Flush the bit buffer, keeping at most 7 bits in it.
  */
-local void bi_flush(s)
-    deflate_state *s;
+local void bi_flush(
+    deflate_state *s
+)
 {
     if (s->bi_valid == 16) {
         put_short(s, s->bi_buf);
@@ -1178,8 +1199,9 @@ local void bi_flush(s)
 /* ===========================================================================
  * Flush the bit buffer and align the output on a byte boundary
  */
-local void bi_windup(s)
-    deflate_state *s;
+local void bi_windup(
+    deflate_state *s
+)
 {
     if (s->bi_valid > 8) {
         put_short(s, s->bi_buf);
diff --git a/lib/libvgz/zutil.c b/lib/libvgz/zutil.c
index fd0cda93b..6a5b32c3e 100644
--- a/lib/libvgz/zutil.c
+++ b/lib/libvgz/zutil.c
@@ -307,19 +307,21 @@ extern voidp  calloc OF((uInt items, uInt size));
 extern void   free   OF((voidpf ptr));
 #endif
 
-voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
-    voidpf opaque;
-    unsigned items;
-    unsigned size;
+voidpf ZLIB_INTERNAL zcalloc (
+    voidpf opaque,
+    unsigned items,
+    unsigned size
+)
 {
     (void)opaque;
     return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
                               (voidpf)calloc(items, size);
 }
 
-void ZLIB_INTERNAL zcfree (opaque, ptr)
-    voidpf opaque;
-    voidpf ptr;
+void ZLIB_INTERNAL zcfree (
+    voidpf opaque,
+    voidpf ptr
+)
 {
     (void)opaque;
     free(ptr);


More information about the varnish-commit mailing list