1994-09-04 04:03:31 +00:00
|
|
|
/* alloc.c - version 1.0.2 */
|
1999-11-16 02:45:03 +00:00
|
|
|
/* $FreeBSD$ */
|
|
|
|
|
1997-09-24 21:09:17 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
1994-09-04 04:03:31 +00:00
|
|
|
#ifdef LINT
|
|
|
|
|
|
|
|
/*
|
|
|
|
a ridiculous definition, suppressing
|
|
|
|
"possible pointer alignment problem" for (long *) malloc()
|
|
|
|
"enlarg defined but never used"
|
|
|
|
"ftell defined (in <stdio.h>) but never used"
|
|
|
|
from lint
|
|
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
long *
|
|
|
|
alloc(n) unsigned n; {
|
|
|
|
long dummy = ftell(stderr);
|
|
|
|
if(n) dummy = 0; /* make sure arg is used */
|
|
|
|
return(&dummy);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
long *
|
|
|
|
alloc(lth)
|
1999-11-16 02:58:06 +00:00
|
|
|
unsigned lth;
|
1994-09-04 04:03:31 +00:00
|
|
|
{
|
1999-11-16 02:58:06 +00:00
|
|
|
char *ptr;
|
1994-09-04 04:03:31 +00:00
|
|
|
|
|
|
|
if(!(ptr = malloc(lth)))
|
|
|
|
panic("Cannot get %d bytes", lth);
|
|
|
|
return((long *) ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
long *
|
|
|
|
enlarge(ptr,lth)
|
1999-11-16 02:58:06 +00:00
|
|
|
char *ptr;
|
|
|
|
unsigned lth;
|
1994-09-04 04:03:31 +00:00
|
|
|
{
|
1999-11-16 02:58:06 +00:00
|
|
|
char *nptr;
|
1994-09-04 04:03:31 +00:00
|
|
|
|
|
|
|
if(!(nptr = realloc(ptr,lth)))
|
|
|
|
panic("Cannot reallocate %d bytes", lth);
|
|
|
|
return((long *) nptr);
|
|
|
|
}
|
|
|
|
|
2002-05-23 00:38:07 +00:00
|
|
|
#endif /* LINT */
|