For rum(4) and ural(4):
[dragonfly/port-amd64.git] / games / hack / alloc.c
blobc97b5c3ffb3f54a33076d025faec54e703fb38a6
1 /* alloc.c - version 1.0.2 */
2 /* $FreeBSD: src/games/hack/alloc.c,v 1.4 1999/11/16 02:57:01 billf Exp $ */
3 /* $DragonFly: src/games/hack/alloc.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */
5 #include "hack.h"
7 #ifdef LINT
9 /*
10 a ridiculous definition, suppressing
11 "possible pointer alignment problem" for (long *) malloc()
12 "enlarg defined but never used"
13 "ftell defined (in <stdio.h>) but never used"
14 from lint
16 long *
17 alloc(size_t n)
19 long dummy = ftell(stderr);
20 if(n) dummy = 0; /* make sure arg is used */
21 return(&dummy);
24 #else
26 void *
27 alloc(size_t lth)
29 void *ptr;
31 if((ptr = malloc(lth)) == NULL)
32 panic("Cannot get %d bytes", lth);
33 return(ptr);
36 #endif /* LINT */