From 0ff887afde567ec0d599735c123f9661faee7e3a Mon Sep 17 00:00:00 2001 From: Ray Lai Date: Thu, 20 Apr 2006 03:25:37 +0000 Subject: Replace magic numbers with sizeof(array). OK jaredy@ --- games/tetris/scores.c | 6 +++--- games/tetris/screen.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'games/tetris') 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); -- cgit v1.2.3