Source:Hack 1.0/alloc.c

Below is the full text to alloc.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/alloc.c#line123 ]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

1.   #ifdef LINT

2.    3.    /*  4.       a ridiculous definition, suppressing 5.   	"possible pointer alignment problem" for (long *) malloc 6.   	"enlarg defined but never used" 7.   	"ftell defined (in ) but never used" 8.      from lint 9.   */  10.   #include   11. long * 12.  alloc(n) unsigned n; { 13.  long dummy = ftell(stderr); 14.  	if(n) dummy = 0;	/* make sure arg is used */ 15.  	return(&dummy); 16.  }  17.    18.   #else 19.   20.   extern char *malloc; 21.  extern char *realloc; 22.   23.   long * 24.  alloc(lth) 25.  register unsigned lth; 26.  {  27.   	register char *ptr; 28.   29.   	if(!(ptr = malloc(lth))) 30.  		panic("Cannot get %d bytes", lth); 31.  	return((long *) ptr); 32.  }  33.    34.   long * 35.  enlarge(ptr,lth) 36.  register char *ptr; 37.  register unsigned lth; 38.  {  39.   	register char *nptr; 40.   41.   	if(!(nptr = realloc(ptr,lth))) 42.  		panic("Cannot reallocate %d bytes", lth); 43.  	return((long *) nptr); 44.  }  45.    46.   #endif LINT