summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/awk/zmalloc.h
blob: 9d9d90c8abb546f1c6ef61d4a27fd6b929410131 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

/********************************************
zmalloc.h
copyright 1991, Michael D. Brennan

This is a source file for mawk, an implementation of
the AWK programming language.

Mawk is distributed without warranty under the terms of
the GNU General Public License, version 2, 1991.
********************************************/

/*$Log: zmalloc.h,v $
/*Revision 1.2  1993/07/02 23:58:04  jtc
/*Updated to mawk 1.1.4
/*
 * Revision 5.1  1991/12/05  07:59:41  brennan
 * 1.1 pre-release
 *
*/

/* zmalloc.h */

#ifndef  ZMALLOC_H
#define  ZMALLOC_H

#if ! HAVE_STDLIB_H
char *malloc() , *realloc() ;
void free() ;
#endif


PTR  PROTO( bmalloc, (unsigned) ) ;
void PROTO( bfree, (PTR, unsigned) ) ;
PTR  PROTO( zrealloc , (PTR,unsigned,unsigned) ) ;


#define ZBLOCKSZ    8    
#define ZSHIFT      3


#define zmalloc(size)  bmalloc((((unsigned)size)+ZBLOCKSZ-1)>>ZSHIFT)
#define zfree(p,size)  bfree(p,(((unsigned)size)+ZBLOCKSZ-1)>>ZSHIFT)

#define ZMALLOC(type)  ((type*)zmalloc(sizeof(type)))
#define ZFREE(p)	zfree(p,sizeof(*(p)))


#endif  /* ZMALLOC_H */