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