diff options
author | B. Watson <yalhcru@gmail.com> | 2015-05-07 16:32:32 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2015-05-07 16:32:32 -0400 |
commit | 013ac7742311556022304e8b30ca170d48b3a016 (patch) | |
tree | 53faa33e75991363f1a6dcc7edc83a66b70e6995 /hack/alloc.c | |
download | bsd-games-extra-013ac7742311556022304e8b30ca170d48b3a016.tar.gz |
initial commit
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 */ |