alloc.c revision 1.1
11.1Scgd/* alloc.c - version 1.0.2 */
21.1Scgd#ifdef LINT
31.1Scgd
41.1Scgd/*
51.1Scgd   a ridiculous definition, suppressing
61.1Scgd	"possible pointer alignment problem" for (long *) malloc()
71.1Scgd	"enlarg defined but never used"
81.1Scgd	"ftell defined (in <stdio.h>) but never used"
91.1Scgd   from lint
101.1Scgd*/
111.1Scgd#include <stdio.h>
121.1Scgdlong *
131.1Scgdalloc(n) unsigned n; {
141.1Scgdlong dummy = ftell(stderr);
151.1Scgd	if(n) dummy = 0;	/* make sure arg is used */
161.1Scgd	return(&dummy);
171.1Scgd}
181.1Scgd
191.1Scgd#else
201.1Scgd
211.1Scgdextern char *malloc();
221.1Scgdextern char *realloc();
231.1Scgd
241.1Scgdlong *
251.1Scgdalloc(lth)
261.1Scgdregister unsigned lth;
271.1Scgd{
281.1Scgd	register char *ptr;
291.1Scgd
301.1Scgd	if(!(ptr = malloc(lth)))
311.1Scgd		panic("Cannot get %d bytes", lth);
321.1Scgd	return((long *) ptr);
331.1Scgd}
341.1Scgd
351.1Scgdlong *
361.1Scgdenlarge(ptr,lth)
371.1Scgdregister char *ptr;
381.1Scgdregister unsigned lth;
391.1Scgd{
401.1Scgd	register char *nptr;
411.1Scgd
421.1Scgd	if(!(nptr = realloc(ptr,lth)))
431.1Scgd		panic("Cannot reallocate %d bytes", lth);
441.1Scgd	return((long *) nptr);
451.1Scgd}
461.1Scgd
471.1Scgd#endif LINT
48