mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-05 20:59:32 +00:00
554eb505f8
of the x11 based games. I'm not going to tag the originals with bsd_44_lite and do this in two stages since it's just not worth it for this collection, and I've got directory renames to deal with that way. Bleah. Submitted by: jkh
48 lines
801 B
C
48 lines
801 B
C
/* 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 <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
|
|
|
|
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
|