Source-Changes-HG archive

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

[src/trunk]: src/games/hangman Pass -Wstrict-overflow



details:   https://anonhg.NetBSD.org/src/rev/0027667a5fdc
branches:  trunk
changeset: 782060:0027667a5fdc
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Oct 13 21:03:09 2012 +0000

description:
Pass -Wstrict-overflow

diffstat:

 games/hangman/prdata.c |  13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diffs (36 lines):

diff -r 950f9c1d3359 -r 0027667a5fdc games/hangman/prdata.c
--- a/games/hangman/prdata.c    Sat Oct 13 21:01:13 2012 +0000
+++ b/games/hangman/prdata.c    Sat Oct 13 21:03:09 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: prdata.c,v 1.6 2012/06/19 05:45:00 dholland Exp $      */
+/*     $NetBSD: prdata.c,v 1.7 2012/10/13 21:03:09 dholland Exp $      */
 
 /*-
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)prdata.c   8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: prdata.c,v 1.6 2012/06/19 05:45:00 dholland Exp $");
+__RCSID("$NetBSD: prdata.c,v 1.7 2012/10/13 21:03:09 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -47,13 +47,12 @@
 void
 prdata(void)
 {
-       bool *bp;
+       int i;
 
        move(GUESSY, GUESSX + sizeof "Guessed: ");
-       bp = Guessed;
-       while (bp < &Guessed[26])
-               if (*bp++)
-                       addch((bp - Guessed) + 'a' - 1);
+       for (i = 0; i < 26; i++)
+               if (Guessed[i])
+                       addch(i + 'a');
        clrtoeol();
        mvprintw(NUMBERY, NUMBERX + sizeof "Word #:          ", "%d", Wordnum);
        mvprintw(AVGY, AVGX + sizeof "Current Average: ", "%.3f",



Home | Main Index | Thread Index | Old Index