GNU bug report logs - #16428
Bug fix for update-game-score.c: consider -m MAX

Previous Next

Package: emacs;

Reported by: Matthias.Habl <at> physik.uni-regensburg.de

Date: Mon, 13 Jan 2014 00:58:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16428 in the body.
You can then email your comments to 16428 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16428; Package emacs. (Mon, 13 Jan 2014 00:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthias.Habl <at> physik.uni-regensburg.de:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 13 Jan 2014 00:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matthias.Habl <at> physik.uni-regensburg.de
To: bug-gnu-emacs <at> gnu.org
Subject: Bug fix for update-game-score.c: consider -m MAX
Date: Sun, 12 Jan 2014 21:11:09 +0100 (CET)
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  <matthias.habl <at> ur.de>

	* 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 <http
*** 51,57 ****
  #endif

  #define MAX_ATTEMPTS 5
- #define MAX_SCORES 200
  #define MAX_DATA_LEN 1024

  #ifndef HAVE_DIFFTIME
--- 51,56 ----
*************** main (int argc, char **argv)
*** 143,149 ****
    const char *prefix, *user_prefix = NULL;
    struct stat buf;
    struct score_entry *scores;
!   int newscore, scorecount, reverse = 0, max = MAX_SCORES;
    char *newdata;

    srand (time (0));
--- 142,148 ----
    const char *prefix, *user_prefix = NULL;
    struct stat buf;
    struct score_entry *scores;
!   int newscore, scorecount, reverse = 0, max = INT_MAX;
    char *newdata;

    srand (time (0));
*************** main (int argc, char **argv)
*** 162,169 ****
  	break;
        case 'm':
  	max = atoi (optarg);
- 	if (max > 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)
      {




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sun, 19 Jan 2014 08:53:02 GMT) Full text and rfc822 format available.

Notification sent to Matthias.Habl <at> physik.uni-regensburg.de:
bug acknowledged by developer. (Sun, 19 Jan 2014 08:53:03 GMT) Full text and rfc822 format available.

Message #10 received at 16428-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 16428-done <at> debbugs.gnu.org
Subject: Re: Bug fix for update-game-score.c: consider -m MAX
Date: Sun, 19 Jan 2014 00:51:59 -0800
Thanks for the bug report; I installed a much-fancier fix as trunk bzr 
116068.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 16 Feb 2014 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 94 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.