diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2009-12-10 23:53:08 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2009-12-10 23:53:08 +0000 |
commit | d3cf963e8bbba50b97f2730e0ba72dc51d93b8fb (patch) | |
tree | 33dc94028fe6c4c1ce2cb9a6aeb04d9cc5edbae8 /games/mille | |
parent | 79da2a70abdd1e1764567ba729aa8a649754334d (diff) |
fix potential bugs spotted by parfait
ok millert@ pjanzen@
Diffstat (limited to 'games/mille')
-rw-r--r-- | games/mille/move.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/games/mille/move.c b/games/mille/move.c index 9e1f97af09a..9a406bb06be 100644 --- a/games/mille/move.c +++ b/games/mille/move.c @@ -1,4 +1,4 @@ -/* $OpenBSD: move.c,v 1.11 2009/10/27 23:59:25 deraadt Exp $ */ +/* $OpenBSD: move.c,v 1.12 2009/12/10 23:53:05 beck Exp $ */ /* $NetBSD: move.c,v 1.4 1995/03/24 05:01:57 cgd Exp $ */ /* @@ -130,11 +130,11 @@ acc: else for (i = 1; i < HAND_SZ; i++) if (pp->hand[i] == C_INIT) { - for (j = 0; pp->hand[j] == C_INIT; j++) - if (j >= HAND_SZ) { - j = 0; - break; - } + for (j = 0; (j < HAND_SZ) && + (pp->hand[j] == C_INIT); j++) + ; + if (j == HAND_SZ) + j = 0; pp->hand[i] = pp->hand[j]; pp->hand[j] = C_INIT; } |