2.5-bk Another final K&R to ANSI C cleanup of zlib

2.5-bk Another final K&R to ANSI C cleanup of zlib

Post by Steven Col » Sat, 07 Jun 2003 03:30:09



Here is another final K&R to ANSI C cleanup patch for zlib.

This was made against the current 2.5 tree after J?rn Engel's recent
cleanups.

Steven

 lib/zlib_deflate/deflate.c |   55 ++++++++++++++++++++++++++-------------------
 lib/zlib_deflate/deftree.c |   12 +++++----
 2 files changed, 39 insertions(+), 28 deletions(-)

diff -ur bk-current/lib/zlib_deflate/deflate.c linux/lib/zlib_deflate/deflate.c
--- bk-current/lib/zlib_deflate/deflate.c       2003-06-05 18:30:07.000000000 -0600

  * 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));

  * 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
+)
 {
     deflate_state *s = (deflate_state *) strm->state;

 /* ===========================================================================
  * 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;

 /* For 80x86 and 680x0, an optimized version will be provided in match.asm or
  * match.S. The code will be functionally equivalent.
  */
-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 */

 /* ===========================================================================
  * Check that the match at match_start is indeed a match.
  */
-local void check_match(s, start, match, length)
-    deflate_state *s;
-    IPos start, match;
-    int length;
+local void check_match(
+       deflate_state *s,
+       IPos start,
+       IPos match,
+       int length
+)
 {
     /* check that the match is indeed a match */

  * NOTE: this function should be optimized to avoid extra copying from
  * window to pending_buf.
  */
-local block_state deflate_stored(s, flush)
-    deflate_state *s;
-    int flush;
+local block_state deflate_stored(
+       deflate_state *s,
+       int flush
+)
 {
     /* Stored blocks are limited to 0xffff bytes, pending_buf is limited

  * 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 = NIL; /* head of the hash chain */

  * 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 = NIL;    /* head of hash chain */
     int bflush;              /* set if current block must be flushed */
diff -ur bk-current/lib/zlib_deflate/deftree.c linux/lib/zlib_deflate/deftree.c
--- bk-current/lib/zlib_deflate/deftree.c       2003-06-05 18:30:41.000000000 -0600

  * this function may be called by two threads concurrently, but this is
  * 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;

 /* ===========================================================================
  * Initialize the tree data structures for a new zlib stream.
  */
-void zlib_tr_init(s)
-    deflate_state *s;
+void zlib_tr_init(
+       deflate_state *s
+)
 {
     tr_static_init();

 /* ===========================================================================
  * 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 */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. 2.5-bk K&R to ANSI conversions for fs/jfs/jfs_dmap.c and jfs_xtree.c

This patch removes the first of the following warnings when doing
make C=1 bzImage with the sparse checker cleverly installed as
/usr/local/bin/sparse.

  CHECK   fs/jfs/jfs_dmap.c
warning: fs/jfs/jfs_dmap.c:3053:14: non-ANSI parameter list
warning: fs/jfs/jfs_dmap.c:1315:10: not addressable
warning: fs/jfs/jfs_dmap.c:1792:8: not addressable
warning: fs/jfs/jfs_dmap.c:3441:10: not addressable
  CC      fs/jfs/jfs_dmap.o

No "non-ANSI parameter list" warnings for fs/jfs/jfs_xtree.c were
received, presumably because _JFS_WIP wasn't defined.  This patch
converts the xtGather function declaration anyway.

Steven

diff -ur bk-current/fs/jfs/jfs_dmap.c linux/fs/jfs/jfs_dmap.c
--- bk-current/fs/jfs/jfs_dmap.c        2003-06-09 18:36:51.000000000 -0600

  * RETURN VALUES:
  *      none
  */
-void fsDirty()
+void fsDirty(void)
 {
        printk("fsDirty(): bye-bye\n");
        assert(0);
diff -ur bk-current/fs/jfs/jfs_xtree.c linux/fs/jfs/jfs_xtree.c
--- bk-current/fs/jfs/jfs_xtree.c       2003-06-09 18:34:10.000000000 -0600

  *      at the current entry at the current subtree root page
  *
  */
-int xtGather(t)
-btree_t *t;
+int xtGather(btree_t *t)
 {
        int rc = 0;
        xtpage_t *p;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. how make a web 'farm'?

3. Compiler (K&R->ANSI C) wanted, C++4.0 forbids K&R-C

4. COM5 Serial Board (Please Help)

5. 2.5-bk trivial LSM cleanup

6. USR 5610A modem problems

7. 2.5.bk no longer boots from NFS root after bk pull this morning

8. Q: PPP dialup to ISP

9. Compiling difference between K&R-C vs. ANSI-C

10. SUMMARY: Converting K&R to ANSI C

11. K&R -> ANSI C formatter

12. K&R C -> ANSI C Transition

13. K&R to ANSI C tools