Karim Belabas on Thu, 20 Nov 1997 19:17:48 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

patch4


> [From my message 9 to this list]:
> default(histsize,1)   \\ clear all
> default(histsize,500) \\ I still want an history after all...
> 
> Hum, this just prompted the discovery two unrelated bugs.
> 1) histsize can't be 0 (I wonder why I forbid it, now that I think of it)
> 2) when histsize is 1 and an error occur, the last result is bizarrely
> forgotten.

Ok, now I remember why I wanted histsize positive (convoluted explanations
available through private email...). So (1) is not a bug after all
(the error message was misspelled, though).

And number (2) was a stupid off-by-1 error. Since I mentioned these on this
list I'm posting a patch, by no means a major one...

Cheers, Karim.

========================= patch 4 (2.0.alpha) ============================

*** src/gp/gp.c.orig	Fri Nov 14 04:53:34 1997
--- src/gp/gp.c	Thu Nov 20 19:05:47 1997
***************
*** 456,462 ****
        {
  	avma = top; tglobal = tloc;
  	try_to_recover=0; recover(listloc); try_to_recover=1;
! 	len = (tglobal % histsize) + 1;
  	for (  ; len<=histsize; len++) g[len]=NULL;
  	parisize = top - bot;
        }
--- 456,462 ----
        {
  	avma = top; tglobal = tloc;
  	try_to_recover=0; recover(listloc); try_to_recover=1;
! 	len = (tglobal % histsize) + 2;
  	for (  ; len<=histsize; len++) g[len]=NULL;
  	parisize = top - bot;
        }
***************
*** 1186,1192 ****
  
      if (newsize==histsize) return;
      if (newsize<1)
!       err(talker,"histsory size must be positive");
      gg = (GEN *) gpmalloc((newsize+1)*sizeof(GEN));
      for (i=0; i<=newsize; i++) gg[i]=NULL;
  
--- 1186,1192 ----
  
      if (newsize==histsize) return;
      if (newsize<1)
!       err(talker,"history size must be positive");
      gg = (GEN *) gpmalloc((newsize+1)*sizeof(GEN));
      for (i=0; i<=newsize; i++) gg[i]=NULL;
  
--
Karim Belabas                          e-mail:
Max-Planck-Institut fuer Mathematik       karim@mpim-bonn.mpg.de
Gottfried-Claren-Str. 26               tel:
53225 Bonn (Germany)                      (00 49 228) 402-245