From 77e3814f0c0e3dea4d0032e25666f77e6f83bfff Mon Sep 17 00:00:00 2001 From: cgd Date: Sun, 21 Mar 1993 09:45:37 +0000 Subject: initial import of 386bsd-0.1 sources --- hack/alloc.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 hack/alloc.c (limited to 'hack/alloc.c') diff --git a/hack/alloc.c b/hack/alloc.c new file mode 100644 index 00000000..d94bf8b9 --- /dev/null +++ b/hack/alloc.c @@ -0,0 +1,47 @@ +/* alloc.c - version 1.0.2 */ +#ifdef LINT + +/* + a ridiculous definition, suppressing + "possible pointer alignment problem" for (long *) malloc() + "enlarg defined but never used" + "ftell defined (in ) but never used" + from lint +*/ +#include +long * +alloc(n) unsigned n; { +long dummy = ftell(stderr); + if(n) dummy = 0; /* make sure arg is used */ + return(&dummy); +} + +#else + +extern char *malloc(); +extern char *realloc(); + +long * +alloc(lth) +register unsigned lth; +{ + register char *ptr; + + if(!(ptr = malloc(lth))) + panic("Cannot get %d bytes", lth); + return((long *) ptr); +} + +long * +enlarge(ptr,lth) +register char *ptr; +register unsigned lth; +{ + register char *nptr; + + if(!(nptr = realloc(ptr,lth))) + panic("Cannot reallocate %d bytes", lth); + return((long *) nptr); +} + +#endif LINT -- cgit v1.2.3-56-ge451