alloc.c revision 1.3
1#ifndef lint
2static char rcsid[] = "$NetBSD: alloc.c,v 1.3 1995/03/23 08:29:14 cgd Exp $";
3#endif /* not lint */
4
5#ifdef LINT
6
7/*
8   a ridiculous definition, suppressing
9	"possible pointer alignment problem" for (long *) malloc()
10	"enlarg defined but never used"
11	"ftell defined (in <stdio.h>) but never used"
12   from lint
13*/
14#include <stdio.h>
15long *
16alloc(n) unsigned n; {
17long dummy = ftell(stderr);
18	if(n) dummy = 0;	/* make sure arg is used */
19	return(&dummy);
20}
21
22#else
23
24extern char *malloc();
25extern char *realloc();
26
27long *
28alloc(lth)
29register unsigned lth;
30{
31	register char *ptr;
32
33	if(!(ptr = malloc(lth)))
34		panic("Cannot get %d bytes", lth);
35	return((long *) ptr);
36}
37
38long *
39enlarge(ptr,lth)
40register char *ptr;
41register unsigned lth;
42{
43	register char *nptr;
44
45	if(!(nptr = realloc(ptr,lth)))
46		panic("Cannot reallocate %d bytes", lth);
47	return((long *) nptr);
48}
49
50#endif LINT
51