diff options
author | mestre <mestre@cvs.openbsd.org> | 2016-02-09 13:42:00 +0000 |
---|---|---|
committer | mestre <mestre@cvs.openbsd.org> | 2016-02-09 13:42:00 +0000 |
commit | c142b696f675fa1c475c9811e27ad0ea539c172f (patch) | |
tree | a2e96ba96ce061858badf77efbf8bc5cef215b4f | |
parent | 280afcb48c604005a1037ba4d475b7e6f37c18a3 (diff) |
- Remove parameter fd from snscore() since it's never used
- And while here, fwrite(3) returns size_t whereas nscores is an int, so cast
nscores to u_int. This is a false positive, but silences a compiler warning
with -Wextra -pedantic
tb@ : "Looks ok to me" after suggestion from him
-rw-r--r-- | games/snake/snake.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/games/snake/snake.c b/games/snake/snake.c index ad0e9538c53..69f3b2f677e 100644 --- a/games/snake/snake.c +++ b/games/snake/snake.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snake.c,v 1.24 2016/02/02 19:18:57 mestre Exp $ */ +/* $OpenBSD: snake.c,v 1.25 2016/02/09 13:41:59 mestre Exp $ */ /* $NetBSD: snake.c,v 1.8 1995/04/29 00:06:41 mycroft Exp $ */ /* @@ -118,7 +118,7 @@ int readscores(int); void setup(void); void snap(void); void snrand(struct point *); -void snscore(int, int); +void snscore(int); void spacewarp(int); void stop(int); int stretch(struct point *); @@ -163,7 +163,7 @@ main(int argc, char *argv[]) break; case 's': /* score */ if (readscores(0)) - snscore(rawscores, 0); + snscore(0); else printf("no scores so far\n"); return 0; @@ -545,13 +545,13 @@ post(int iscore, int flag) iscore, rank + 1); rewind(sf); - if (fwrite(scores, sizeof(scores[0]), nscores, sf) < nscores) + if (fwrite(scores, sizeof(scores[0]), nscores, sf) < (u_int)nscores) err(1, "fwrite"); if (fclose(sf)) err(1, "fclose"); /* See if we have a new champ */ - snscore(rawscores, TOPN); + snscore(TOPN); return(1); } @@ -879,7 +879,7 @@ pushsnake(void) logit("eaten"); #endif length(moves); - snscore(rawscores, TOPN); + snscore(TOPN); close(rawscores); exit(0); } @@ -953,7 +953,7 @@ length(int num) } void -snscore(int fd, int topn) +snscore(int topn) { int i; |