[comp.sources.bugs] calls bug + fix

tom@unicads.UUCP (Tom Gerardy) (02/14/89)

The version of calls we have has a bug for static functions which are used
before being defined, i.e.:

static void initialize();
  ...
main (argc, argv)
{
  initialize();	/* calls dies here */
  ...
}
  ...
static void initialize()
{
  ...
}

Follows a patch to fix this problem.

*** scan.c.orig	Mon Feb 13 13:35:58 1989
--- scan.c	Mon Feb 13 12:05:23 1989
***************
*** 57,63 ****
  
  	ppHT = & pHTRoot[1];	/* first search statics	*/
  	while((pHT = *ppHT) && (i = strcmp(pHT->pchname, name)) <= 0) {
! 		if (0 == i && 0 == strcmp(pchFile, pHT->pchfile))
  			break;	/* found a visible static function	*/
  		ppHT = & pHT->pHTnext;
  		i = 1;
--- 57,65 ----
  
  	ppHT = & pHTRoot[1];	/* first search statics	*/
  	while((pHT = *ppHT) && (i = strcmp(pHT->pchname, name)) <= 0) {
! 		if (0 == i
! 			&& (0 ==  pHT->pchfile || 0 == strcmp(pchFile, pHT->pchfile))
! 		)
  			break;	/* found a visible static function	*/
  		ppHT = & pHT->pHTnext;
  		i = 1;

---
   - Tom Gerardy             UUCP: ...!sun!sunpeaks!unicads!tom
     UNICAD, Inc.              or: ...!ncar!{sunpeaks|boulder}!unicads!tom
     1695 38th Street
     Boulder, Colo.  80301         (303) 443-6961

-- 
   - Tom Gerardy             UUCP: ...!sun!sunpeaks!unicads!tom
     UNICAD, Inc.              or: ...!ncar!{sunpeaks|boulder}!unicads!tom
     1695 38th Street
     Boulder, Colo.  80301         (303) 443-6961