diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-11-26 23:42:54 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-11-26 23:42:54 +0100 |
commit | cf861ae13a04a5c94432471e48b64523d5ddfcce (patch) | |
tree | e1d1da6399867e7b9759453fada52a9e4b134f0c /FICS | |
parent | 81920970de9d4c5f5b39bfacb27d812c73d5d7c4 (diff) |
Use sizeof
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/ratings.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/FICS/ratings.c b/FICS/ratings.c index 2839bd5..c542fe4 100644 --- a/FICS/ratings.c +++ b/FICS/ratings.c @@ -1470,7 +1470,7 @@ UpdateRank(int type, char *addName, statistics *sNew, char *delName) return; } - while (fgets(line, MAX_RANK_LINE - 1, fp)) { + while (fgets(line, sizeof line, fp) != NULL) { sscanf(line, "%s %d %d %d", login, &sCur.rating, &sCur.num, &comp); @@ -1540,7 +1540,7 @@ GetRank(FILE *fp, char *target, int countComp) int nGames, is_computer; int playerFound = 0; - while (fgets(line, MAX_RANK_LINE - 1, fp) && + while (fgets(line, sizeof line, fp) != NULL && !playerFound) { sscanf(line, "%s %*d %d %d", login, &nGames, &is_computer); @@ -1567,7 +1567,7 @@ PositionFilePtr(FILE *fp, int count, int *last, int *nTied, int showComp) for (int i = 1; i < count; i++) { do { - fgets(line, MAX_RANK_LINE - 1, fp); + fgets(line, sizeof line, fp); if (feof(fp)) break; @@ -1599,7 +1599,7 @@ ShowRankEntry(int p, FILE *fp, int count, int comp, char *target, if (findable) { do { - fgets(newLine, MAX_RANK_LINE - 1, fp); + fgets(newLine, sizeof newLine, fp); if (feof(fp)) { findable = 0; |