summaryrefslogtreecommitdiff
path: root/games/tetris
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-04-20 03:25:37 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-04-20 03:25:37 +0000
commit0ff887afde567ec0d599735c123f9661faee7e3a (patch)
tree5957a843724bedce94a0657bd4a7f58184d986e2 /games/tetris
parent5d75087b8fdf1c7fbec78cc3b93a71d67561141f (diff)
Replace magic numbers with sizeof(array).
OK jaredy@
Diffstat (limited to 'games/tetris')
-rw-r--r--games/tetris/scores.c6
-rw-r--r--games/tetris/screen.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/games/tetris/scores.c b/games/tetris/scores.c
index 3442e2cda53..5f52b02b706 100644
--- a/games/tetris/scores.c
+++ b/games/tetris/scores.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scores.c,v 1.10 2004/07/10 07:26:24 deraadt Exp $ */
+/* $OpenBSD: scores.c,v 1.11 2006/04/20 03:25:36 ray Exp $ */
/* $NetBSD: scores.c,v 1.2 1995/04/22 07:42:38 cgd Exp $ */
/*-
@@ -412,14 +412,14 @@ printem(int level, int offset, struct highscore *hs, int n, const char *me)
for (row = 0; row < n; row++) {
sp = &hs[row];
- (void)snprintf(buf, 100,
+ (void)snprintf(buf, sizeof(buf),
"%3d%c %6d %-31s (%6d on %d)\n",
row + offset, sp->hs_time ? '*' : ' ',
sp->hs_score * sp->hs_level,
sp->hs_name, sp->hs_score, sp->hs_level);
/* Print leaders every three lines */
if ((row + 1) % 3 == 0) {
- for (i = 0; i < 100; i++)
+ for (i = 0; i < sizeof(buf); i++)
if (buf[i] == ' ')
buf[i] = '_';
}
diff --git a/games/tetris/screen.c b/games/tetris/screen.c
index dc647fb00d1..7b954f0cad7 100644
--- a/games/tetris/screen.c
+++ b/games/tetris/screen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen.c,v 1.12 2004/07/10 07:26:24 deraadt Exp $ */
+/* $OpenBSD: screen.c,v 1.13 2006/04/20 03:25:36 ray Exp $ */
/* $NetBSD: screen.c,v 1.4 1995/04/29 01:11:36 mycroft Exp $ */
/*-
@@ -271,7 +271,7 @@ scr_set(void)
if (Rows < MINROWS || Cols < MINCOLS) {
char smallscr[55];
- (void) snprintf(smallscr, 55,
+ (void)snprintf(smallscr, sizeof(smallscr),
"the screen is too small (must be at least %dx%d)",
MINROWS, MINCOLS);
stop(smallscr);