[alt.sources.patches] patch to simil.c

aluko@portia.Stanford.EDU (Stephen Goldschmidt) (03/02/90)

This patch is intended to fix a bug in simil.c that allows characters
to be counted twice in GCsubstr.

*** simil.c	Fri Jan 19 11:25:14 1990
--- simil2.c	Thu Mar  1 12:58:41 1990
***************
*** 51,55
  			if( *a1 == *a2 ) {
  				/* determine length of common substring */
! 				for( i = 1; a1[i] && (a1[i] == a2[i]); i++ ) 
  					;
  				if( i > max ) {

--- 51,56 -----
  			if( *a1 == *a2 ) {
  				/* determine length of common substring */
! 				for( i = 1; a1+i < end1 && a2+i < end2 && 
!                                      a1[i] == a2[i]; i++ ) 
  					;
  				if( i > max ) {
--
Stephen Goldschmidt, aluko@portia.Stanford.EDU