local_scan: align local_scan.h and docs re. store_get()
[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 /* 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
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 };
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
23 extern void *store_last_get[6];
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
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__)
37 /* store_get & store_get_perm are in local_scan.h */
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__)
48
49
50 /* The real functions */
51 typedef void ** rmark;
52
53 extern BOOL    store_extend_3(void *, BOOL, int, int, const char *, int);
54 extern void    store_free_3(void *, const char *, int);
55 /* store_get_3 & store_get_perm_3 are in local_scan.h */
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);
61
62 #endif  /* STORE_H */
63
64 /* End of store.h */