From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jason Feng Newsgroups: gmane.emacs.bugs Subject: bug#4397: 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> Reply-To: Jason Feng , 4397@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1252672771 3731 80.91.229.12 (11 Sep 2009 12:39:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Sep 2009 12:39:31 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 11 14:39:24 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mm5PP-000488-Qm for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Sep 2009 14:39:24 +0200 Original-Received: from localhost ([127.0.0.1]:45545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mm5PP-0002Ti-8d for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Sep 2009 08:39:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MluI7-0000vh-PO for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:47:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MluI2-0000n2-2t for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:47:06 -0400 Original-Received: from [199.232.76.173] (port=44125 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MluI1-0000me-T7 for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:47:01 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:59476) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MluI1-0004nA-Az for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:47:01 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8B0kxfu005921; Thu, 10 Sep 2009 17:46:59 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n8B0U4QL002975; Thu, 10 Sep 2009 17:30:04 -0700 Resent-Date: Thu, 10 Sep 2009 17:30:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Jason Feng Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Fri, 11 Sep 2009 00:30:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 4397 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.12526284641554 (code B ref -1); Fri, 11 Sep 2009 00:30:04 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 11 Sep 2009 00:21:04 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8B0L26i001550 for ; Thu, 10 Sep 2009 17:21:04 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mltsr-0000FJ-Mg for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:21:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mltso-0000F7-VN for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:21:01 -0400 Original-Received: from [199.232.76.173] (port=46916 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mltso-0000F4-Sx for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:20:58 -0400 Original-Received: from 173-13-141-233-sfba.hfc.comcastbusiness.net ([173.13.141.233]:52468 helo=athena.ozbert.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mltso-00012Q-Hy for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:20:58 -0400 Original-Received: from jfeng by athena.ozbert.com with local (Exim 4.63) (envelope-from ) id 1MltSM-0007fc-IF for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 16:53:38 -0700 Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) X-Greylist: delayed 1668 seconds by postgrey-1.27 at monty-python; Thu, 10 Sep 2009 20:20:52 EDT X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Thu, 10 Sep 2009 20:47:06 -0400 X-Mailman-Approved-At: Fri, 11 Sep 2009 08:12:53 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:30957 Archived-At: 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