1 | /* |
---|
2 | * Copyright (C) 2001 - 2004 Mike Wray <mike.wray@hp.com> |
---|
3 | * |
---|
4 | * This library is free software; you can redistribute it and/or modify |
---|
5 | * it under the terms of the GNU Lesser General Public License as published by |
---|
6 | * the Free Software Foundation; either version 2.1 of the License, or |
---|
7 | * (at your option) any later version. |
---|
8 | * |
---|
9 | * This library is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | * GNU Lesser General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU Lesser General Public License |
---|
15 | * along with this library; if not, write to the Free Software |
---|
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _XUTIL_ALLOCATE_H_ |
---|
20 | #define _XUTIL_ALLOCATE_H_ |
---|
21 | |
---|
22 | /** Allocate memory for a given type, and cast. */ |
---|
23 | #define ALLOCATE(ctype) (ctype *)allocate(sizeof(ctype)) |
---|
24 | |
---|
25 | /** Allocate memory for a given type, and cast. */ |
---|
26 | #define ALLOCATE_TYPE(ctype, type) (ctype *)allocate(sizeof(ctype)) |
---|
27 | |
---|
28 | extern void *allocate_type(int size, int type); |
---|
29 | extern void *allocate(int size); |
---|
30 | extern void deallocate(void *); |
---|
31 | extern void memzero(void *p, int size); |
---|
32 | |
---|
33 | typedef void AllocateFailedFn(int size, int type); |
---|
34 | extern AllocateFailedFn *allocate_failed_fn; |
---|
35 | |
---|
36 | #endif /* _XUTIL_ALLOCATE_H_ */ |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | |
---|