1 /* $Id: alloc.h,v 1.14 1994/06/24 11:06:36 ceriel Exp $ */
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
6 #ifndef __ALLOC_INCLUDED__
7 #define __ALLOC_INCLUDED__
8 /* PROGRAM'S INTERFACE TO MEMORY ALLOCATION ROUTINES */
10 /* This file serves as the interface between the program and the
11 memory allocating routines.
12 There are 3 memory allocation routines:
13 char *Malloc(n) allocate n bytes
14 char *Salloc(str, n) allocate n bytes and fill them with
16 char *Realloc(str, n) reallocate the block at str to n bytes.
17 char *Srealloc(str, n) same as Realloc.
21 char *Malloc(unsigned int);
22 char *Salloc(char *, unsigned int);
23 char *Srealloc(char *, unsigned int);
24 char *Realloc(char *, unsigned int);
25 char *st_alloc(char **, unsigned int, int);
26 char *std_alloc(char **, unsigned int, int, int *);
28 void clear(char *, unsigned int);
29 void botch(char *, unsigned int);
31 extern char *Salloc(), *Malloc(), *Srealloc(), *Realloc();
32 extern char *st_alloc(), *std_alloc();
33 void clear(), botch(), No_Mem();
36 /* S T R U C T U R E - S T O R A G E D E F I N I T I O N S */
38 typedef struct _ALLOC_ {
39 struct _ALLOC_ *_A_next;
43 #define _A_st_free(ptr, phead, size) (((_PALLOC_)ptr)->_A_next = \
45 *((_PALLOC_ *)phead) = \
48 #define st_free(ptr, phead, size) _A_st_free(ptr, phead, size)
49 #else /* def BOTCH_FREE */
50 #define st_free(ptr, phead, size) (botch((char *)(ptr), size), \
51 _A_st_free(ptr, phead, size))
52 #endif /* BOTCH_FREE */
54 #define Free(p) free(p)
56 #endif /* __ALLOC_INCLUDED__ */