diff options
Diffstat (limited to 'hack/alloc.c')
-rw-r--r-- | hack/alloc.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/hack/alloc.c b/hack/alloc.c new file mode 100644 index 0000000..5d72997 --- /dev/null +++ b/hack/alloc.c @@ -0,0 +1,38 @@ +/* alloc.c - version 1.0.2 */ +/* $FreeBSD: src/games/hack/alloc.c,v 1.4 1999/11/16 02:57:01 billf Exp $ */ +/* $DragonFly: src/games/hack/alloc.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */ + +#include "hack.h" + +#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 +*/ +long * +alloc(size_t n) +{ + long dummy = ftell(stderr); + + if (n) + dummy = 0; /* make sure arg is used */ + return (&dummy); +} + +#else + +void * +alloc(size_t lth) +{ + void *ptr; + + if ((ptr = malloc(lth)) == NULL) + panic("Cannot get %zd bytes", lth); + return (ptr); +} + +#endif /* LINT */ |