[comp.sources.bugs] Sc4.1 bug and fix

rgb@nscpdc.NSC.COM (Robert Bond) (10/22/87)

There is a problem in version 4.1 of sc.  Defined range names are not
deleted when a new data base is loaded with a G (get) command.  This
causes trouble because the range names then point at wrong (or
deleted!) cells.  Also, new ranges by the same name cannot be loaded
into the spread sheet.

Here is the fix.  Point this file at the source directory as 

patch -d <source directory> < file


------------------------- diffs for range.c-----------------------

*** range.c.b	Wed Oct 21 13:34:31 1987
--- range.c	Wed Oct 21 13:36:17 1987
***************
*** 77,82 ****
--- 77,98 ----
      xfree((char *)r);
  }
  
+ clean_range()
+ {
+     register struct range *r;
+     register struct range *nextr;
+ 
+     r = rng_base;
+     rng_base = 0;
+ 
+     while (r) {
+ 	nextr = r->r_next;
+ 	xfree((char *)(r->r_name));
+ 	xfree((char *)r);
+ 	r = nextr;
+     }
+ }
+ 	
  /* Match on name or lmatch, rmatch */
  
  struct range *

------------ diffs for sc.c ----------------------

*** sc.c.b	Wed Oct 21 13:37:11 1987
--- sc.c	Wed Oct 21 13:37:56 1987
***************
*** 1006,1011 ****
--- 1006,1012 ----
  		*p = 0;
  	    }
      }
+     clean_range();
      maxrow = 0;
      maxcol = 0;
      FullUpdate++;
-- 
    Robert Bond 			ihnp4!nsc!nscpdc!rgb
    National Semiconductor		tektronix!nscpdc!rgb