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