Source-Changes-HG archive

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

[src/trunk]: src/games/monop Avoid undefined behavior, from Chris Spiegel in ...



details:   https://anonhg.NetBSD.org/src/rev/1baea1def130
branches:  trunk
changeset: 757842:1baea1def130
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Sep 26 21:12:23 2010 +0000

description:
Avoid undefined behavior, from Chris Spiegel in PR 43860.

diffstat:

 games/monop/cards.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r b9d3f6d559ff -r 1baea1def130 games/monop/cards.c
--- a/games/monop/cards.c       Sun Sep 26 18:52:52 2010 +0000
+++ b/games/monop/cards.c       Sun Sep 26 21:12:23 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cards.c,v 1.23 2008/02/24 03:56:48 christos Exp $      */
+/*     $NetBSD: cards.c,v 1.24 2010/09/26 21:12:23 dholland Exp $      */
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)cards.c    8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: cards.c,v 1.23 2008/02/24 03:56:48 christos Exp $");
+__RCSID("$NetBSD: cards.c,v 1.24 2010/09/26 21:12:23 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -247,7 +247,7 @@
        do {
                thiscard = &dp->info[dp->top_card];
                type_maj = thiscard->actioncode[0];
-               dp->top_card = ++(dp->top_card) % dp->num_cards;
+               dp->top_card = (dp->top_card + 1) % dp->num_cards;
        } while (dp->gojf_used && type_maj == GOJF);
        type_min = thiscard->actioncode[1];
        num = atoi(thiscard->actioncode+2);



Home | Main Index | Thread Index | Old Index