Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/backgammon KNF and WARNS=3 fixes



details:   https://anonhg.NetBSD.org/src/rev/dd603d2702e9
branches:  trunk
changeset: 582572:dd603d2702e9
user:      jmc <jmc%NetBSD.org@localhost>
date:      Fri Jul 01 01:12:39 2005 +0000

description:
KNF and WARNS=3 fixes

diffstat:

 games/backgammon/backgammon/extra.c    |   16 +--
 games/backgammon/backgammon/main.c     |   11 +-
 games/backgammon/backgammon/move.c     |   70 ++++++++---------
 games/backgammon/backgammon/text.c     |    7 +-
 games/backgammon/backgammon/version.c  |    6 +-
 games/backgammon/common_source/allow.c |    6 +-
 games/backgammon/common_source/back.h  |    8 +-
 games/backgammon/common_source/board.c |    8 +-
 games/backgammon/common_source/check.c |    9 +-
 games/backgammon/common_source/fancy.c |  131 +++++++++++++++++---------------
 games/backgammon/common_source/odds.c  |   12 +-
 games/backgammon/common_source/one.c   |   21 ++---
 games/backgammon/common_source/save.c  |   13 +--
 games/backgammon/common_source/subs.c  |   52 +++++-------
 games/backgammon/common_source/table.c |   13 +--
 games/backgammon/teachgammon/teach.c   |   10 +-
 games/backgammon/teachgammon/ttext2.c  |    7 +-
 games/backgammon/teachgammon/tutor.c   |   14 +-
 18 files changed, 192 insertions(+), 222 deletions(-)

diffs (truncated from 1336 to 300 lines):

diff -r dba951076cf6 -r dd603d2702e9 games/backgammon/backgammon/extra.c
--- a/games/backgammon/backgammon/extra.c       Fri Jul 01 00:48:34 2005 +0000
+++ b/games/backgammon/backgammon/extra.c       Fri Jul 01 01:12:39 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extra.c,v 1.5 2003/08/07 09:36:55 agc Exp $    */
+/*     $NetBSD: extra.c,v 1.6 2005/07/01 01:12:39 jmc Exp $    */
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)extra.c    8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: extra.c,v 1.5 2003/08/07 09:36:55 agc Exp $");
+__RCSID("$NetBSD: extra.c,v 1.6 2005/07/01 01:12:39 jmc Exp $");
 #endif
 #endif /* not lint */
 
@@ -51,7 +51,7 @@
  */
 
 void
-dble()
+dble(void)
 {
        int     resp;           /* response to y/n */
 
@@ -113,7 +113,7 @@
  */
 
 int
-dblgood()
+dblgood(void)
 {
        int     n;              /* accumulated judgment */
        int     OFFC = *offptr; /* no. of computer's men off */
@@ -188,8 +188,7 @@
 }
 
 int
-freemen(b)
-       int     b;
+freemen(int b)
 {
        int     i, inc, lim;
 
@@ -207,8 +206,7 @@
 }
 
 int
-trapped(n, inc)
-       int     n, inc;
+trapped(int n, int inc)
 {
        int     i, j, k;
        int     c, l, ct;
@@ -234,7 +232,7 @@
 }
 
 int
-eval()
+eval(void)
 {
        int     i, j;
 
diff -r dba951076cf6 -r dd603d2702e9 games/backgammon/backgammon/main.c
--- a/games/backgammon/backgammon/main.c        Fri Jul 01 00:48:34 2005 +0000
+++ b/games/backgammon/backgammon/main.c        Fri Jul 01 01:12:39 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.21 2005/02/15 12:56:20 jsm Exp $    */
+/*     $NetBSD: main.c,v 1.22 2005/07/01 01:12:39 jmc Exp $    */
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: main.c,v 1.21 2005/02/15 12:56:20 jsm Exp $");
+__RCSID("$NetBSD: main.c,v 1.22 2005/07/01 01:12:39 jmc Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -88,9 +88,7 @@
 static char pbuf[10];
 
 int
-main(argc, argv)
-       int     argc __attribute__((__unused__));
-       char  **argv;
+main(int argc __attribute__((__unused__)), char **argv)
 {
        int     i;              /* non-descript index */
        int     l;              /* non-descript index */
@@ -420,7 +418,8 @@
                                                writec('\n');
                                        text(helpm);
                                        if (tflag)
-                                               curmove(cturn == -1 ? 18 : 19, 0);
+                                               curmove(cturn == -1 ? 
+                                                   18 : 19, 0);
                                        else
                                                writec('\n');
 
diff -r dba951076cf6 -r dd603d2702e9 games/backgammon/backgammon/move.c
--- a/games/backgammon/backgammon/move.c        Fri Jul 01 00:48:34 2005 +0000
+++ b/games/backgammon/backgammon/move.c        Fri Jul 01 01:12:39 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: move.c,v 1.8 2004/01/27 20:30:28 jsm Exp $     */
+/*     $NetBSD: move.c,v 1.9 2005/07/01 01:12:39 jmc Exp $     */
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)move.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: move.c,v 1.8 2004/01/27 20:30:28 jsm Exp $");
+__RCSID("$NetBSD: move.c,v 1.9 2005/07/01 01:12:39 jmc Exp $");
 #endif
 #endif /* not lint */
 
@@ -92,9 +92,9 @@
 static struct BOARD *nextfree(void);
 
 
+/* zero if first move */
 void
-move(okay)
-       int     okay;           /* zero if first move */
+move(int okay)
 {
        int     i;              /* index */
        int     l;              /* last man */
@@ -181,10 +181,10 @@
        fixtty(&raw);           /* no more tty interrupt */
 }
 
+/*     mvnum   == number of move (rel zero) */
+/*     swapped == see if swapped also tested */
 void
-trymove(mvnum, swapped)
-       int     mvnum;          /* number of move (rel zero) */
-       int     swapped;        /* see if swapped also tested */
+trymove(int mvnum, int swapped)
 {
        int     pos;            /* position on board */
        int     rval;           /* value of roll */
@@ -234,7 +234,7 @@
 }
 
 static struct BOARD *
-bsave()
+bsave(void)
 {
        int     i;              /* index */
        struct BOARD *now;      /* current position */
@@ -255,52 +255,50 @@
        return (now);
 }
 
+/* new == item to insert */
 static void
-binsert(new)
-       struct BOARD *new;      /* item to insert */
+binsert(struct BOARD *new)
 {
-       struct BOARD *p = checkq;       /* queue pointer */
+       struct BOARD *qp = checkq;      /* queue pointer */
        int     result;         /* comparison result */
 
-       if (p == 0) {           /* check if queue empty */
-               checkq = p = new;
-               p->b_next = 0;
+       if (qp == 0) {          /* check if queue empty */
+               checkq = qp = new;
+               qp->b_next = 0;
                return;
        }
-       result = bcomp(new, p); /* compare to first element */
+       result = bcomp(new, qp);        /* compare to first element */
        if (result < 0) {       /* insert in front */
-               new->b_next = p;
+               new->b_next = qp;
                checkq = new;
                return;
        }
        if (result == 0) {      /* duplicate entry */
-               mvcheck(p, new);
+               mvcheck(qp, new);
                makefree(new);
                return;
        }
-       while (p->b_next != 0) {/* traverse queue */
-               result = bcomp(new, p->b_next);
+       while (qp->b_next != 0) {/* traverse queue */
+               result = bcomp(new, qp->b_next);
                if (result < 0) {       /* found place */
-                       new->b_next = p->b_next;
-                       p->b_next = new;
+                       new->b_next = qp->b_next;
+                       qp->b_next = new;
                        return;
                }
                if (result == 0) {      /* duplicate entry */
-                       mvcheck(p->b_next, new);
+                       mvcheck(qp->b_next, new);
                        makefree(new);
                        return;
                }
-               p = p->b_next;
+               qp = qp->b_next;
        }
        /* place at end of queue */
-       p->b_next = new;
+       qp->b_next = new;
        new->b_next = 0;
 }
 
 static int
-bcomp(a, b)
-       struct BOARD *a;
-       struct BOARD *b;
+bcomp(struct BOARD *a, struct BOARD *b)
 {
        int    *aloc = a->b_board;      /* pointer to board a */
        int    *bloc = b->b_board;      /* pointer to board b */
@@ -316,9 +314,7 @@
 }
 
 static void
-mvcheck(incumbent, candidate)
-       struct BOARD *incumbent;
-       struct BOARD *candidate;
+mvcheck(struct BOARD *incumbent, struct BOARD *candidate)
 {
        int     i;
        int     result;
@@ -339,15 +335,14 @@
 }
 
 void
-makefree(dead)
-       struct BOARD *dead;     /* dead position */
+makefree(struct BOARD *dead)
 {
        dead->b_next = freeq;   /* add to freeq */
        freeq = dead;
 }
 
 static struct BOARD *
-nextfree()
+nextfree(void)
 {
        struct BOARD *new;
 
@@ -367,7 +362,7 @@
 }
 
 void
-pickmove()
+pickmove(void)
 {
        /* current game position */
        struct BOARD *now = bsave();
@@ -391,8 +386,7 @@
 }
 
 static void
-boardcopy(s)
-       struct BOARD *s;        /* game situation */
+boardcopy(struct BOARD *s)
 {
        int     i;              /* index */
 
@@ -409,7 +403,7 @@
 }
 
 void
-movcmp()
+movcmp(void)
 {
        int     i;
 
@@ -483,7 +477,7 @@
 }
 
 int
-movegood()
+movegood(void)
 {
        int     n;
 
diff -r dba951076cf6 -r dd603d2702e9 games/backgammon/backgammon/text.c
--- a/games/backgammon/backgammon/text.c        Fri Jul 01 00:48:34 2005 +0000
+++ b/games/backgammon/backgammon/text.c        Fri Jul 01 01:12:39 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: text.c,v 1.7 2003/08/07 09:36:56 agc Exp $     */
+/*     $NetBSD: text.c,v 1.8 2005/07/01 01:12:39 jmc Exp $     */
 



Home | Main Index | Thread Index | Old Index