Commit | Line | Data |
---|---|---|
059ec3d9 PH |
1 | /************************************************* |
2 | * Exim - an Internet mail transport agent * | |
3 | *************************************************/ | |
4 | ||
0a49a7a4 | 5 | /* Copyright (c) University of Cambridge 1995 - 2009 */ |
059ec3d9 PH |
6 | /* See the file NOTICE for conditions of use and distribution. */ |
7 | ||
8 | /* Header for Exim's memory allocation functions */ | |
9 | ||
10 | #ifndef STORE_H | |
11 | #define STORE_H | |
12 | ||
13 | /* Define symbols for identifying the store pools. */ | |
14 | ||
f3ebb786 JH |
15 | enum { POOL_MAIN, POOL_PERM, POOL_SEARCH, |
16 | POOL_TAINT_BASE, | |
17 | POOL_TAINT_MAIN = POOL_TAINT_BASE, POOL_TAINT_PERM, POOL_TAINT_SEARCH }; | |
059ec3d9 PH |
18 | |
19 | /* This variable (the one for the current pool) is set by store_get() to its | |
20 | yield, and by store_reset() to NULL. This allows string_cat() to optimize its | |
21 | store handling. */ | |
22 | ||
f3ebb786 | 23 | extern void *store_last_get[6]; |
059ec3d9 PH |
24 | |
25 | /* This variable contains the current store pool number. */ | |
26 | ||
27 | extern int store_pool; | |
28 | ||
29 | /* Macros for calling the memory allocation routines with | |
30 | tracing information for debugging. */ | |
31 | ||
f3ebb786 JH |
32 | #define store_extend(addr, tainted, old, new) \ |
33 | store_extend_3(addr, tainted, old, new, __FUNCTION__, __LINE__) | |
34 | ||
35 | #define store_free(addr) \ | |
36 | store_free_3(addr, __FUNCTION__, __LINE__) | |
4ec0fcb6 | 37 | /* store_get & store_get_perm are in local_scan.h */ |
f3ebb786 JH |
38 | #define store_malloc(size) \ |
39 | store_malloc_3(size, __FUNCTION__, __LINE__) | |
40 | #define store_mark(void) \ | |
41 | store_mark_3(__FUNCTION__, __LINE__) | |
42 | #define store_newblock(addr, tainted, newsize, datalen) \ | |
43 | store_newblock_3(addr, tainted, newsize, datalen, __FUNCTION__, __LINE__) | |
44 | #define store_release_above(addr) \ | |
45 | store_release_above_3(addr, __FUNCTION__, __LINE__) | |
46 | #define store_reset(mark) \ | |
47 | store_reset_3(mark, store_pool, __FUNCTION__, __LINE__) | |
059ec3d9 PH |
48 | |
49 | ||
50 | /* The real functions */ | |
f3ebb786 | 51 | typedef void ** rmark; |
059ec3d9 | 52 | |
f3ebb786 | 53 | extern BOOL store_extend_3(void *, BOOL, int, int, const char *, int); |
459fca58 | 54 | extern void store_free_3(void *, const char *, int); |
4ec0fcb6 | 55 | /* store_get_3 & store_get_perm_3 are in local_scan.h */ |
f3ebb786 JH |
56 | extern void *store_malloc_3(int, const char *, int) ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT; |
57 | extern rmark store_mark_3(const char *, int); | |
58 | extern void *store_newblock_3(void *, BOOL, int, int, const char *, int); | |
59 | extern void store_release_above_3(void *, const char *, int); | |
60 | extern rmark store_reset_3(rmark, int, const char *, int); | |
059ec3d9 PH |
61 | |
62 | #endif /* STORE_H */ | |
63 | ||
64 | /* End of store.h */ |