all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: owner@emacsbugs.donarmstrong.com (Emacs bug Tracking System)
To: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#4397: marked as done (23.0.60; update-game-score doesn't update when MAX_SCORES entries are present)
Date: Fri, 11 Sep 2009 19:20:04 +0000	[thread overview]
Message-ID: <handler.4397.D4397.12526962838550.ackdone@emacsbugs.donarmstrong.com> (raw)
In-Reply-To: 20090910235338.GA29473@ozbert.com

[-- Attachment #1: Type: text/plain, Size: 969 bytes --]

Your message dated Fri, 11 Sep 2009 15:11:20 -0400
with message-id <jwvocphnvqs.fsf-monnier+emacsbugreports@gnu.org>
and subject line Re: bug#4397: 23.0.60; update-game-score doesn't update when MAX_SCORES entries are present
has caused the Emacs bug report #4397,
regarding 23.0.60; update-game-score doesn't update when MAX_SCORES entries are present
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
4397: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4397
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 3369 bytes --]

From: Jason Feng <jfeng@ozbert.com>
To: bug-gnu-emacs@gnu.org
Subject: 23.0.60; update-game-score doesn't update when MAX_SCORES entries are present
Date: Thu, 10 Sep 2009 16:53:38 -0700
Message-ID: <20090910235338.GA29473@ozbert.com>

When attempting to run "update-game-score," when there are 200 entries
in the score file, the new score is never included.  Apparently, the
INTENDED behavior is that the new score is included if it is larger
than the minimum entry, pushing out the minimum entry, but this doesn't
happen.  

I have isolated the cause to the following lines in update-game-score.c
(pulled from the latest git tree):

(starts at line 255)
  push_score (&scores, &scorecount, newscore, user_id, newdata);
  /* 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. */
  if (scorecount > MAX_SCORES)
    scorecount -= (scorecount - MAX_SCORES);
  if (reverse)
    scores += (scorecount - MAX_SCORES);
  sort_scores (scores, scorecount, reverse);

As push_score adds the new score at the end of the score list, when the
scorecount gets decremented, there is no chance for the new score to
ever get included (when reverse is zero, that is).  Really the decrement
of scorecount should happen after the scores have been sorted.

Regards,
Jason Feng



[-- Attachment #3: Type: message/rfc822, Size: 3828 bytes --]

From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Jason Feng <jfeng@ozbert.com>
Subject: Re: bug#4397: 23.0.60; update-game-score doesn't update when MAX_SCORES entries are present
Date: Fri, 11 Sep 2009 15:11:20 -0400
Message-ID: <jwvocphnvqs.fsf-monnier+emacsbugreports@gnu.org>

> ever get included (when reverse is zero, that is).  Really the decrement
> of scorecount should happen after the scores have been sorted.

Indeed, thank you.  I've just installed the patch below,


        Stefan


Index: lib-src/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lib-src/ChangeLog,v
retrieving revision 2.541
diff -u -r2.541 ChangeLog
--- lib-src/ChangeLog	9 Sep 2009 02:32:25 -0000	2.541
+++ lib-src/ChangeLog	11 Sep 2009 19:10:04 -0000
@@ -1,3 +1,8 @@
+2009-09-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* update-game-score.c (main): Sort scores before trimming them,
+	reported by Jason Feng <jfeng@ozbert.com> (bug#4397).
+
 2009-09-09  Glenn Morris  <rgm@gnu.org>
 
 	* Makefile.in ($(DESTDIR)${archlibdir}): Set umask to world-readable
Index: lib-src/update-game-score.c
===================================================================
RCS file: /sources/emacs/emacs/lib-src/update-game-score.c,v
retrieving revision 1.27
diff -u -r1.27 update-game-score.c
--- lib-src/update-game-score.c	8 Jan 2009 03:38:53 -0000	1.27
+++ lib-src/update-game-score.c	11 Sep 2009 19:10:04 -0000
@@ -254,6 +254,7 @@
       lose_syserr ("Failed to read scores file");
     }
   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
@@ -262,7 +263,6 @@
     scorecount -= (scorecount - MAX_SCORES);
     if (reverse)
       scores += (scorecount - MAX_SCORES);
-  sort_scores (scores, scorecount, reverse);
   if (write_scores (scorefile, scores, scorecount) < 0)
     {
       unlock_file (scorefile, lockstate);


      reply	other threads:[~2009-09-11 19:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <jwvocphnvqs.fsf-monnier+emacsbugreports@gnu.org>
2009-09-10 23:53 ` bug#4397: 23.0.60; update-game-score doesn't update when MAX_SCORES entries are present Jason Feng
2009-09-11 19:20   ` Emacs bug Tracking System [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=handler.4397.D4397.12526962838550.ackdone@emacsbugs.donarmstrong.com \
    --to=owner@emacsbugs.donarmstrong.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.