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