xref: /original-bsd/usr.bin/pascal/libpc/DISPOSE.c (revision b4971bb3)
1 /*-
2  * Copyright (c) 1979, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)DISPOSE.c	8.1 (Berkeley) 06/06/93";
10 #endif /* not lint */
11 
12 #include	"h00vars.h"
13 
14 DISPOSE(var, siz)
15 	register char	**var;	/* pointer to pointer being deallocated */
16 	long		siz;	/* sizeof(bletch) */
17 {
18 	register int size = siz;
19 
20 	if (*var == 0 || *var + size > _maxptr || *var < _minptr) {
21 		ERROR("Pointer value out of legal range\n", 0);
22 		return;
23 	}
24 	free(*var);
25 	if (*var == _minptr)
26 		_minptr += size;
27 	if (*var + size == _maxptr)
28 		_maxptr -= size;
29 	*var = (char *)(0);
30 }
31