From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthias.Habl@physik.uni-regensburg.de Newsgroups: gmane.emacs.bugs Subject: bug#16428: Bug fix for update-game-score.c: consider -m MAX Date: Sun, 12 Jan 2014 21:11:09 +0100 (CET) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Trace: ger.gmane.org 1389574696 14936 80.91.229.3 (13 Jan 2014 00:58:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 13 Jan 2014 00:58:16 +0000 (UTC) To: 16428@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 13 01:58:21 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W2VrB-0001ct-9X for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Jan 2014 01:58:21 +0100 Original-Received: from localhost ([::1]:40047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2VrB-0005D5-0j for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 Jan 2014 19:58:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Vr0-00052l-0l for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 19:58:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2Vqt-00016K-4c for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 19:58:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34152) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Vqt-00016E-2L for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 19:58:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W2Vqs-0005ST-K7 for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 19:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Matthias.Habl@physik.uni-regensburg.de Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Jan 2014 00:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16428 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138957462420900 (code B ref -1); Mon, 13 Jan 2014 00:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Jan 2014 00:57:04 +0000 Original-Received: from localhost ([127.0.0.1]:48171 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W2Vpv-0005R0-76 for submit@debbugs.gnu.org; Sun, 12 Jan 2014 19:57:04 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48641) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W2RNW-000685-Bz for submit@debbugs.gnu.org; Sun, 12 Jan 2014 15:11:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2RNP-0007w0-65 for submit@debbugs.gnu.org; Sun, 12 Jan 2014 15:11:25 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:39949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2RNP-0007vl-3l for submit@debbugs.gnu.org; Sun, 12 Jan 2014 15:11:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2RNI-0007Hg-K2 for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 15:11:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2RNC-0007kR-K2 for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 15:11:12 -0500 Original-Received: from rrzmta1.uni-regensburg.de ([194.94.155.51]:41744) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2RNC-0007kD-DT for bug-gnu-emacs@gnu.org; Sun, 12 Jan 2014 15:11:06 -0500 Original-Received: from rrzmta1.uni-regensburg.de (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 5F939F2D6 for ; Sun, 12 Jan 2014 21:11:04 +0100 (CET) Original-Received: from [192.168.1.2] (rgnb-5d87d82a.pool.mediaWays.net [93.135.216.42]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: ham03789) by rrzmta1.uni-regensburg.de (Postfix) with ESMTPSA id 11E7AA21A for ; Sun, 12 Jan 2014 21:11:03 +0100 (CET) X-X-Sender: mat@mhamd64 User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Sun, 12 Jan 2014 19:57:00 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:83379 Archived-At: The auxiliary program update-game-score claims: -m MAX Limit the maximum number of scores to MAX. However, this numeric option is not considered at all. The limiting routine refers just to the fixed value #define MAX_SCORES 200 The following patch establishes the usage of the variable 'max' which is set by '-m MAX'. The macro for MAX_SCORES is not necessary any longer. 2013-01-12 Matthias Habl * update-game-score.c (MAX_SCORES, max): omit MAX_SCORES, use variable 'max' according to option '-m MAX' instead Patch against the current Savannah code: diff -cp update-game-score-trunk.c update-game-score.c *** update-game-score-trunk.c 2014-01-12 15:04:32.582660242 +0100 --- update-game-score.c 2014-01-12 15:09:16.227157027 +0100 *************** along with GNU Emacs. If not, see MAX_SCORES) - max = MAX_SCORES; break; default: usage (EXIT_FAILURE); --- 161,166 ---- *************** main (int argc, char **argv) *** 209,219 **** 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) { if (reverse) ! scores += (scorecount - MAX_SCORES); ! scorecount = MAX_SCORES; } if (write_scores (scorefile, scores, scorecount) < 0) { --- 206,216 ---- 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) { if (reverse) ! scores += (scorecount - max); ! scorecount = max; } if (write_scores (scorefile, scores, scorecount) < 0) {