summaryrefslogtreecommitdiff
path: root/lib-src/update-game-score.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-03-22 18:01:59 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-03-22 18:01:59 -0700
commitc9c49752e15c105ded153e9ab0a42743f57184e5 (patch)
treee395db95d87459082bace9fcf3a2cec0ea3d1aea /lib-src/update-game-score.c
parent9d0da923ebd2b78abb6e02f0b90cfe9d818eb301 (diff)
parentb9b4b7cb4c27f9f6ad644168f0e1241e5c0d6eaa (diff)
downloademacs-c9c49752e15c105ded153e9ab0a42743f57184e5.tar.gz
emacs-c9c49752e15c105ded153e9ab0a42743f57184e5.tar.bz2
emacs-c9c49752e15c105ded153e9ab0a42743f57184e5.zip
Fix more problems found by GCC 4.5.2's static checks.
Diffstat (limited to 'lib-src/update-game-score.c')
-rw-r--r--lib-src/update-game-score.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index 70b79a64f91..e95e2ce259d 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -242,13 +242,15 @@ main (int argc, char **argv)
push_score (&scores, &scorecount, newscore, user_id, newdata);
sort_scores (scores, scorecount, reverse);
/* Limit the number of scores. If we're using reverse sorting, then
- we should increment the beginning of the array, to skip over the
- *smallest* scores. Otherwise, we just decrement the number of
- scores, since the smallest will be at the end. */
+ also increment the beginning of the array, to skip over the
+ *smallest* scores. Otherwise, just decrementing the number of
+ scores suffices, since the smallest is at the end. */
if (scorecount > MAX_SCORES)
- scorecount -= (scorecount - MAX_SCORES);
- if (reverse)
- scores += (scorecount - MAX_SCORES);
+ {
+ if (reverse)
+ scores += (scorecount - MAX_SCORES);
+ scorecount = MAX_SCORES;
+ }
if (write_scores (scorefile, scores, scorecount) < 0)
{
unlock_file (scorefile, lockstate);